Error codes

Error codes provide stable, programmatic identifiers for specific failure conditions.

Use these codes to implement conditional logic in your integration.


Structure

Error codes are returned in the code field of the error object.

Example
{
  "type": "card_error",
  "code": "card_declined",
  "decline_code": "insufficient_funds",
  "message": "Your card has insufficient funds.",
  "trace_id": "trc_123"
}

Categories

Invalid request errors

Errors caused by invalid input or request structure.

Examples:

  • parameter_invalid
  • missing_required_param
  • amount_too_large

Recommended handling:

  • Do not retry
  • Fix the request data
  • Display validation errors to the user

Authentication errors

Errors caused by missing or invalid credentials.

Examples:

  • authentication_failed
  • invalid_api_key

Recommended handling:

  • Verify credentials
  • Do not retry without fixing authentication

Card errors

Errors caused by card or issuer behavior.

Examples:

  • card_declined
  • expired_card
  • incorrect_number

Recommended handling:

  • Use decline_code and advice_code
  • Prompt the customer for action if needed

Processing errors

Errors caused by temporary processing issues.

Examples:

  • processing_error
  • issuer_unavailable

Recommended handling:

  • Retry later
  • Do not retry immediately in a tight loop

Rate limiting errors

Errors caused by exceeding request limits.

Examples:

  • rate_limit_exceeded

Recommended handling:

  • Back off and retry later
  • Implement exponential backoff

Handling strategy

Check error type

Determine whether the error is caused by input, authentication, or processing.

Inspect error code

Use the code to identify the specific failure condition.

Apply handling logic

Decide whether to retry, prompt the user, or fail the request.


Best practices

  • Treat error codes as stable integration contracts
  • Avoid parsing error messages programmatically
  • Combine code with other fields such as decline_code
  • Keep retry logic explicit and controlled