Rate limits
Test mode has a ceiling, so a load test against it slows down your own test requests and nobody else’s:
- 25 requests a second per test key, and 100 a second per account over all its test keys. Each has a second’s worth to spend at once, so a short burst passes and a steady stream above the rate does not.
- Live mode has no such limit.
A request over either is refused before anything runs:
HTTP/1.1 429 Too Many RequestsRetry-After: 1
{"error": {"type": "rate_limit_error", "code": "rate_limit", "message": "Too many requests in test mode: at most 25 per second per key."}}- The status is
429, the typerate_limit_errorand the coderate_limit. The message names the limit you went over, the key’s or the account’s. Retry-Afteris the number of seconds to wait before you send it again.- Nothing ran, so the request is safe to retry: send a create again with the same
Idempotency-Key.
Handling it
Section titled “Handling it”- Wait at least
Retry-Afterseconds, then retry. Back off further if the next retry is refused too. - Spread a load test over time, not over keys: the account’s limit counts every test key of the account together.
- In CI, run tests that create payments one after another, or a few at a time, rather than all at once.