Error Anatomy
All 88Pay errors follow this structure:Error Categories
4xx Client Errors
🛑 Client Errors: Your code has an issue
| Code | Name | What It Means | Fix It |
|---|---|---|---|
400 | Bad Request | Invalid parameters | Validate input |
401 | Unauthorized | Token expired/invalid | Refresh token |
403 | Forbidden | No access | Check permissions |
404 | Not Found | Resource doesn’t exist | Verify ID |
422 | Unprocessable | Business rule violation | Check logic |
429 | Too Many Requests | Rate limited | Slow down |
5xx Server Errors
| Code | Name | What Happened | Action |
|---|---|---|---|
500 | Internal Error | Something broke on our end | Retry |
502 | Bad Gateway | Proxy issue | Retry |
503 | Service Unavailable | Temporarily down | Retry |
504 | Gateway Timeout | Request took too long | Retry |
The Retry Game
Level 1: Basic Retry
Level 2: Smart Retry with Backoff
Level 3: Boss Mode (Circuit Breaker)
Error Recipes
🔑 401: Token Expired
🔑 401: Token Expired
Symptom:Cure:
🚦 429: Rate Limited
🚦 429: Rate Limited
Symptom:Cure:Prevention:
- Cache tokens (50s TTL)
- Queue requests
- Use rate limiter middleware
🔴 500: Server Hiccup
🔴 500: Server Hiccup
❌ 400: Bad Input
❌ 400: Bad Input
Symptom:Cure:
🚫 422: Method Not Available
🚫 422: Method Not Available
Symptom:Cure:
Error Monitoring Dashboard
What to Track
- 📊 Metrics
- 📝 Structured Logs
- 🔔 Alerts
Production-Ready Error Handler
Complete example with all best practices:Testing Error Scenarios
Use these techniques to test your error handling:Go-Live Checklist
- ✅ Exponential backoff implemented for 5xx errors
- ✅ Token refresh logic for 401 errors
- ✅ Rate limit handling with backoff
- ✅ Input validation prevents 400 errors
- ✅ Circuit breaker for cascading failures
- ✅ Structured logging (no sensitive data)
- ✅ Error monitoring with alerts
- ✅ User-friendly error messages
- ✅ Correlation IDs for debugging
- ✅ All error scenarios tested
Quick Reference
| Status | Retry? | Backoff | Max Attempts |
|---|---|---|---|
400 | ❌ | - | - |
401 | ✅ Once | Immediate | 1 |
403 | ❌ | - | - |
404 | ❌ | - | - |
422 | ❌ | - | - |
429 | ✅ | Exponential | 3-5 |
500 | ✅ | Exponential | 3 |
502 | ✅ | Exponential | 3 |
503 | ✅ | Exponential | 3 |
504 | ✅ | Exponential | 3 |

