Errors

Errors use HTTP status codes and a JSON body that says what went wrong.

HTTP 400
{
  "error": {
    "code": "invalid_request",
    "message": "amount must be a positive integer",
    "param": "amount"
  }
}
  • code is stable and meant for your code to check.
  • message is for people; its wording can change.
  • param is set when one request parameter is at fault.

Codes

CodeStatusMeaning
invalid_request400A parameter is missing or invalid. param names it.
invalid_json400The body is not valid JSON.
unauthorized401No API key, or the key is invalid or revoked.
forbidden403The key is not allowed to do this (e.g. a restricted key without the permission).
account_not_active403A live key was used before the account is active.
not_found404No such object (or it belongs to the other mode).
invalid_state409The object is not in a state that allows this, e.g. refunding an unpaid payment.
idempotency_conflict409The Idempotency-Key was used before with a different request.
rate_limited429Too many requests. Back off and retry.
internal_error500Something went wrong on our side. Safe to retry with the same Idempotency-Key.
provider_error502The bank returned an error.
provider_unavailable503The bank is not reachable right now. Retry later.

Retrying

429, 500, 502 and 503 are worth retrying with exponential back-off. Send the same Idempotency-Key on every retry of a POST so it can never be applied twice. 4xx errors other than 429 will fail again until you change the request.