Technical concepts
Rate limits
Merxian limits the number of requests that each account can send. A request over the limit returns 429 with the time to wait.
On this page
Request rate#
| Limit | Current value | Response over the limit |
|---|---|---|
| All requests of an account | 1,000 requests per minute | 429 with RateLimited and a Retry-After header |
| Checkout session creation of an account | 100 sessions per minute | 429 with RateLimitExceeded, without Retry-After |
The values can change. Do not design your integration around the exact numbers. Handle 429 in every client.
Handle a 429 response#
- If the response has
Retry-After, wait that number of seconds. - If it does not, wait with exponential backoff: for example 1, 2, 4, then 8 seconds, up to a maximum.
- Add random jitter to each wait, so that many clients do not retry at the same moment.
- Retry with the same
Idempotency-Key. See Idempotency.
function waitMs(attempt: number, retryAfter: string | null): number {
if (retryAfter !== null) return Number(retryAfter) * 1000
const base = Math.min(30_000, 1000 * 2 ** attempt)
return base / 2 + Math.random() * (base / 2)
}To stay under the limit:
- Use webhook events instead of polling. See Webhooks.
- Use
limit=100when you page through lists. - Spread batch jobs over time.
Request limits#
| Limit | Value | Response |
|---|---|---|
| Request body size | 64 KiB | 413 with ValidationFailed |
| Time to complete a request | About 3 seconds | 504 with UpstreamUnavailable |
A 504 does not tell you whether the operation ran. Retry with the same Idempotency-Key: if the first request completed, the retry returns its result.
Test your 429 handling in sandbox before you go live.