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 |

