Error Handling
The Open Pay API uses conventional HTTP status codes and a consistent error response format. This guide covers every error scenario and how to handle them.Error Response Format
All errors follow a standard JSON structure:HTTP Status Codes
Common Error Codes
- Authentication Errors
- Payment Errors
- Webhook Errors
- Settlement Errors
Rate Limiting
The API enforces rate limits to ensure fair usage. When you exceed the limit, you receive a429 response.
Rate limit headers are included in every response:
Default limits:
Example 429 response:
Handling Rate Limits
Retry Strategies
1
Identify Retryable Errors
Only retry on these status codes:
- 429 - Rate limit exceeded (wait for
X-RateLimit-Reset) - 500 - Internal server error (transient)
- 502/503/504 - Gateway errors (transient)
400, 401, 403, 404, 409, or 422 errors. These require fixing the request.2
Use Exponential Backoff
Increase the delay between retries exponentially with jitter:
3
Set a Maximum Retry Count
Limit retries to 3-5 attempts. If the request still fails, log the error and alert your monitoring system.
4
Use Idempotency Keys
For
POST requests (especially payment creation), include an Idempotency-Key header so retries don’t create duplicate resources:Idempotency keys are scoped to your merchant account and expire after 24 hours. Using the same key with the same parameters returns the original response without creating a new resource.