Errors

Standard HTTP error codes and formats.

The API returns standard HTTP status codes. Errors include a JSON body with an error field.

Status codes

CodetypeMeaning
400invalid_request_errorBad request — invalid or missing parameters
401authentication_errorMissing or invalid API key
402card_errorPayment failed — charge was declined
403permission_errorSecret key required for this endpoint
404not_found_errorResource doesn't exist
409idempotency_errorConflict — resource or idempotency key reused
429rate_limit_errorToo many requests
5xxapi_errorSomething went wrong on Paysio's side

Error response format

Branch on type rather than the error sentence — the wording may change, the category will not.

JSON
{
  "error": "Customer not found",   // human-readable (wording may change)
  "type": "not_found_error",       // stable category — branch on this
  "code": "resource_missing"       // specific code where one applies
}

Failed charges

A charge that is declined (402) or that could not be completed (503) carries extra fields naming the cause, so you do not have to parse the error sentence.

JavaScript
// Failed charge — POST /v1/charges
{
  "error": "Charge declined: Insufficient funds (202)",
  "code": "insufficient_funds",     // stable Paysio code — branch on this
  "decline_code": "202",            // the gateway's own code, verbatim
  "category": "insufficient_funds", // see the table below
  "reference_id": "8134729",        // quote this to support
  "data": { /* the transaction record */ }
}

Decline categories

categoryWhat to do
declinedThe issuer said no. Ask for a different card; retrying the same one will not help.
insufficient_fundsAsk for a different card.
invalid_cardThe number or expiry is wrong. Ask the customer to re-enter it.
cvcThe security code is missing or wrong. Collect it again.
unsupported_cardThis card type cannot be used on this workspace's gateway (e.g. a credit card on a debit-only rail).
duplicateThe gateway matched a recent identical attempt. Wait before retrying.
configurationA problem with the merchant account, not the card. Contact support with the reference_id.
gateway_unavailableReturned with 503. The outcome is not yet known, so do not assume the charge failed — retry with the same reference_id, which is refused if the first attempt is still unresolved.
unknownWe could not classify it. Read error and quote the reference_id.

The status code separates the two failure kinds: 402 is a definite failure (no money moved — safe to retry with a new reference_id once the customer fixes it), 503 is an unknown outcome (retry with the same reference_id). A card rejected before the charge is attempted returns 402, so an unusable card no longer looks like an outage.