Error Handling

Error Code

Payssion uses conventional HTTP response codes to indicate the success or failure of an API request.

  • Status codes in 2xx range indicates success.
  • Status codes in 4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted, a payment failed, etc.).
  • Status codes in 5xx range indicate an error with Payssion's servers. (rare)

Some 4xx errors that could be handled programmatically (e.g., a mandate is declined) include an error code that briefly explains the error reported.

Error Message

Type

The type field of error are one of these:

  • api_error
  • gateway_error
  • invalid_request_error

Message

A human-readable message providing more details about the error.

Code (optional)

Specific types of error codes designed to help handle programmatically, see the list below for details.

CodeRemark
system_errorContact Payssion for help
unauthorizedCheck API authorization credential
idempotency_errorCheck idempotency key
livemode_requiredNot allowed in test mode
request_invalidCheck request basic params, e.g. URL, HTTP method
rate_limitRequest rate out of frequency limit
parameter_invalidCheck request business params
resource_invalidThe requested resource is invalid
resource_status_invalidThe requested resource status is invalid
resource_not_foundThe requested resource status is not found
gateway_connection_errorSomething connection problem occurred when calling Payssion's gateway
gateway_request_errorSomething error occurred when calling Payssion's gateway
gateway_parse_errorSomething data parsing problem occurred when calling Payssion's gateway
gateway_parameter_invalidSomething parameter wrong when calling Payssion's gateway

param (optional)

Errors related to a parameter return the name of the parameter field.

status (in header)

As a return value in response to an HTTP status code, this could be: 400, 401, 402, 404, 500, 504

Sample

{
    "error": {
        "type": "invalid_request_error",
        "message": "Received unknown parameter: abc",
        "param": "abc",
        "code": "request_param_error"
    }
}

Failure Code

The failure_code is usually a more detailed and specific item that provides the error that occurred on the object. There are the following possible failure enumerations:

failure_code
gateway_connection_error
gateway_system_error
gateway_parse_error
gateway_parameter_invalid
gateway_failure_message
gateway_request_error
payment_closed
payment_failed
payment_expired
payment_fully_refunded
insufficient_account_balance
insufficient_funds
refund_not_paid
refund_not_found
refund_refused
refund_failed
payout_validation_fail
business_not_supported