Error Response Format
All API errors return a consistent JSON structure:| Field | Type | Description |
|---|---|---|
status_code | number | HTTP status code |
message | string | HTTP status message |
error | string | Human-readable error description |
errors | string[] | Array of validation errors (when applicable) |
HTTP Status Codes
Success Codes
| Code | Description |
|---|---|
200 OK | Request succeeded |
201 Created | Resource created successfully |
204 No Content | Request succeeded with no response body |
Client Error Codes
| Code | Description | Common Causes |
|---|---|---|
400 Bad Request | Invalid request | Validation errors, malformed JSON |
401 Unauthorized | Authentication failed | Missing or invalid API key |
403 Forbidden | Access denied | Insufficient permissions |
404 Not Found | Resource not found | Invalid ID or deleted resource |
409 Conflict | Resource conflict | Duplicate entry or state conflict |
422 Unprocessable Entity | Business logic error | Insufficient balance, expired payment |
429 Too Many Requests | Rate limit exceeded | Slow down requests |
Server Error Codes
| Code | Description | Action |
|---|---|---|
500 Internal Server Error | Server error | Retry with backoff |
502 Bad Gateway | Upstream error | Retry with backoff |
503 Service Unavailable | Service down | Check status page |
Common Error Scenarios
Validation Errors
When request validation fails, you’ll receive a400 response with details:
Authentication Errors
Missing or invalid API key returns401:
Resource Not Found
When a resource doesn’t exist:Insufficient Balance
When attempting a payment without sufficient funds:Payment Already Processed
When trying to notify for an already processed payment:Error Handling Best Practices
1. Always Check Status Codes
2. Implement Retry Logic
For transient errors (5xx), implement exponential backoff:3. Handle Rate Limits
If you receive a429 response, respect the Retry-After header:
Idempotency
For payment creation, use theidempotency_key field to safely retry requests: