Rate Limiting
The API implements rate limiting to ensure fair usage and maintain service reliability.
Handling Rate Limits
If your requests are being rate limited, the API will return a 429 Too Many Requests response.
Exponential Backoff
Implement exponential backoff to handle rate limits gracefully:
async function makeRequestWithRetry(url, options, maxRetries = 5) {
let retryCount = 0;
while (retryCount < maxRetries) {
const response = await fetch(url, options);
if (response.status === 429) {
const delay = 2 ** retryCount * 1000;
console.log(`Rate limited. Waiting ${delay}ms before retry`);
await new Promise((resolve) => setTimeout(resolve, delay));
retryCount++;
continue;
}
return response;
}
throw new Error('Max retries exceeded');
}
Best Practices
- Use webhooks instead of polling for payment status updates
- Cache responses when possible to reduce API calls
- Implement retry logic with exponential backoff
- Batch operations where possible