Error Handling
The ChainPal API uses conventional HTTP status codes to indicate the success or failure of requests. All error responses follow a consistent JSON structure.HTTP Status Codes
| Code | Status | Description |
|---|---|---|
200 | OK | Request succeeded |
400 | Bad Request | Invalid request parameters or validation error |
401 | Unauthorized | Missing or invalid API key |
403 | Forbidden | Valid API key but access denied (e.g., IP not whitelisted) |
404 | Not Found | Requested resource doesn’t exist |
429 | Too Many Requests | Rate limit exceeded |
500 | Internal Server Error | Server-side error |
Error Response Format
All error responses use this structure:| Field | Type | Description |
|---|---|---|
success | boolean | Always false for errors |
message | string | Human-readable error description |
data | null | Always null for errors |
Common Errors
Authentication Errors (401)
Missing API KeyAuthorization Errors (403)
IP Not WhitelistedValidation Errors (400)
Missing Required FieldNot Found Errors (404)
Payment Not FoundRate Limit Errors (429)
Too Many RequestsServer Errors (500)
Generic Server ErrorHandling Errors
Best Practices
-
Check the
successfield first -
Handle specific status codes
-
Implement retry logic for transient errors
-
Log errors for debugging
Validation Rules
Amount Field
- Must be a positive number
- Must meet minimum and maximum limits for the currency
- See Types & Enums for limits
Reference Field
- Optional (auto-generated if not provided)
- 12-16 alphanumeric characters
- Must be unique per merchant
Email Field
- Must be a valid email format
URL Fields (callbackURL, failureURL)
- Must be valid URLs
- Must use HTTPS protocol
Token/Network
- Must be a supported combination for your country
- See Types & Enums

