Rate Limiting
RazCrypto applies rate limits to protect the API from abuse.
Current Limits
| Tier | Limit | Window |
|---|---|---|
| Default | 60 requests | Per minute, per IP |
| Webhook delivery | 3 retries | Exponential backoff |
Rate Limit Headers
Response Headers
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 45
X-RateLimit-Reset: 1642176300
Handling Rate Limit Errors (RZ_020)
JavaScript — Exponential Backoff
async function createPaymentWithRetry(payload, maxRetries = 3) {
for (let attempt = 1; attempt <= maxRetries; attempt++) {
try {
return await RazCrypto.createPayment(payload);
} catch (error) {
if (error.message.includes('RZ_020')) {
const waitMs = Math.pow(2, attempt) * 1000;
console.log(`Rate limit hit, waiting ${waitMs}ms...`);
await new Promise(r => setTimeout(r, waitMs));
continue;
}
throw error;
}
}
throw new Error('Max retries exceeded');
}