HTTP Status Codes
Here are the common HTTP status codes you may encounter when using our API:200 - Success
The request was successful, and the intended action was completed.For charge or verification requests, always check the
data object to confirm the specific outcome (success or failure).201 - Created
A new resource was successfully created.204 - No Content
The request was successful, but no content is returned in the response.400 - Bad Request
A validation or client-side error occurred, preventing the request from being processed.401 - Unauthorized
The request was not authorized. This commonly occurs due to:- Invalid secret key in authorization header
- Missing authorization header
- Expired API key
- Using test key in production environment
- Using production key in test environment
403 - Forbidden
Access to the requested resource is denied due to insufficient permissions.404 - Not Found
The requested resource could not be found.This status code does not apply when a payment session is completed.
422 - Unprocessable Entity
Some required fields are missing or invalid, preventing the request from being processed.429 - Too Many Requests
You’ve exceeded the API rate limits.500 - Server Error
The request could not be fulfilled due to an error on Juicyway’s server.Error Response Format
All API errors follow a consistent format:Common Error Types
Validation Errors
When required fields are missing or invalid:Authentication Errors
When there are issues with API keys or authentication:Rate Limiting Errors
When you exceed the API rate limits:Server Errors
For 500-level server errors:Error Handling Best Practices
Timeout Handling
Rate Limit Handling
To handle rate limits effectively:- Implement exponential backoff with jitter for retries
- Check the
retry_afterheader to know when to retry - Cache frequently requested data
- Batch requests where possible
Server Error Handling
Best practices for handling server errors:- Log the
request_idfor debugging - Implement retry logic with exponential backoff
- Contact support if errors persist
- Set up monitoring for error rates
Code Examples
Here’s how to properly handle API errors in different languages:- Node.js
- Python