RASPAY

Errors

Error response format and list of codes.

Errors use HTTP status codes and always have the same format. Build your logic on code, which is stable. message is text for people, comes in Portuguese and may change.

  • code: error identifier.
  • message: readable description.
  • details: optional. On validation errors, a list of { field, message }.
422 invalid_request
{
  "error": {
    "code": "invalid_request",
    "message": "Parâmetros inválidos.",
    "details": [
      {
        "field": "amount",
        "message": "Invalid input: expected number, received undefined"
      }
    ]
  }
}

Codes

HTTPcodeWhen it happens
400invalid_jsonThe body is not valid JSON.
401unauthorizedMissing, invalid or revoked API key.
402insufficient_fundsAvailable balance lower than amount plus fee.
403account_not_activeAccount not yet approved to operate in live mode.
403account_blockedAccount blocked. Contact support.
403charges_blockedOnly incoming payments are blocked on the account: new charges are refused; payouts continue.
403payouts_blockedOnly outgoing payments are blocked on the account: new payouts are refused; charges continue.
403negative_balance_limitAccount with a negative balance beyond the allowed limit: new charges and payouts are blocked until it is settled. Repeating a creation with the same Idempotency-Key still returns the original record.
403ip_not_allowedThe call came from an IP that is not in the allowed IPs of the account.
403key_not_allowedThe live key does not have permission to make payouts.
403forbiddenAction not allowed in the current state of the resource or in this environment.
404not_foundResource does not exist, or belongs to another account or environment.
404receipt_unavailableReceipt only for Pix payouts that are paid, have an E2E and were not returned.
409idempotency_conflictIdempotency-Key already used with other parameters.
409idempotency_in_progressThe original request is still in progress.
409conflictConflict while creating the charge. Repeat the request.
422invalid_requestInvalid parameters. See details.
422amount_limit_exceededAmount above the limit allowed per transaction.
429rate_limitedRequest limit reached.
500internal_errorUnexpected error on our side.
502provider_errorThe operation could not be processed.
503provider_unavailablePayment service currently unavailable.

What to retry

  • 4xx: do not retry without fixing the request. The exceptions are 429, which can be retried after waiting, and idempotency_in_progress.
  • 5xx on payouts, or timeout: retry with the same Idempotency-Key. Never create a new payout without knowing what happened to the previous one.
  • 503 on charges: try again. You can reuse the same key: a charge that failed on creation releases the key.