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

  1. Use webhooks instead of polling for payment status updates
  2. Cache responses when possible to reduce API calls
  3. Implement retry logic with exponential backoff
  4. Batch operations where possible

Next Steps