Error Response Format
API errors are returned in the following format.Error type (
authentication_error, invalid_request_error, payment_error, api_error)Error code (see below)
Error description
Request ID (use when contacting support)
Parameter that caused the error (for validation errors)
Detailed error information (for validation errors)
Authentication Errors
| Code | HTTP Status | Description |
|---|---|---|
unauthorized | 401 | Authorization header is invalid or missing |
merchant_not_active | 403 | Merchant account is deactivated |
Validation Errors
| Code | HTTP Status | Description |
|---|---|---|
validation_error | 400 | Invalid request parameters. Details are in the details field |
invalid_amount | 400 | Invalid amount |
amount_below_minimum | 400 | Amount is below minimum |
amount_above_maximum | 400 | Amount exceeds maximum |
unsupported_currency | 400 | Unsupported currency |
Payment Errors
| Code | HTTP Status | Description |
|---|---|---|
payment_failed | 400 | Payment processing failed |
invalid_status | 400 | Operation cannot be performed in current status |
invalid_state | 400 | Invalid transaction state |
invalid_transaction | 400 | Transaction is invalid |
not_supported | 400 | This operation is not supported |
capture_failed | 400 | Capture failed |
refund_failed | 400 | Refund failed |
card_limit_exceeded | 400 | Monthly card spending limit exceeded |
email_limit_exceeded | 400 | Monthly email spending limit exceeded |
recurring_not_supported | 400 | Connector does not support recurring payments |
Webhook Payment Error Codes
When a payment fails, thepayment.failed webhook includes detailed error information in a unified format that is consistent across all payment providers.
Error Structure
Error Categories
| Category | Description | Recommended Action |
|---|---|---|
authentication | 3DS authentication required | Redirect customer to complete authentication |
soft_decline | Temporary failure | Retry or use a different card |
hard_decline | Permanent failure | Do not retry with the same card |
gateway_error | Payment gateway issue | Retry later |
Unified Error Codes
| Code | Category | Description | Recommended Action |
|---|---|---|---|
authentication_required | authentication | 3DS authentication required | contact_customer |
authentication_failed | soft_decline | 3DS authentication failed | retry |
card_declined | soft_decline | Card was declined | use_different_card |
insufficient_funds | soft_decline | Insufficient funds | use_different_card |
expired_card | hard_decline | Card has expired | use_different_card |
invalid_card | hard_decline | Invalid card number | use_different_card |
invalid_cvc | soft_decline | Invalid security code | retry |
invalid_expiry | soft_decline | Invalid expiration date | retry |
fraud_detected | hard_decline | Suspected fraud | none |
stolen_card | hard_decline | Stolen card | none |
lost_card | hard_decline | Lost card | none |
processing_error | gateway_error | Processing error | retry |
gateway_timeout | gateway_error | Gateway timeout | retry |
gateway_unavailable | gateway_error | Gateway unavailable | retry |
unknown_error | soft_decline | Unknown error | use_different_card |
Handling Example
The
psp_error field contains the original payment provider’s error details for debugging purposes.Refund Errors
| Code | HTTP Status | Description |
|---|---|---|
invalid_amount | 400 | Refund amount exceeds payment amount |
invalid_status | 400 | Not in refundable status (only completed can be refunded) |
Resource Errors
| Code | HTTP Status | Description |
|---|---|---|
not_found | 404 | Specified resource not found |
flow_not_found | 404 | Payment flow not found |
no_default_flow | 404 | Default payment flow not configured |
flow_not_active | 400 | Payment flow is disabled |
connector_config_not_found | 404 | Connector configuration not found |
Idempotency Errors
| Code | HTTP Status | Description |
|---|---|---|
idempotency_key_mismatch | 400 | Different request sent with same idempotency key |
idempotency_key_in_use | 409 | Idempotency key is currently being processed |
System Errors
| Code | HTTP Status | Description |
|---|---|---|
internal_error | 500 | Internal error occurred. Please contact support |
Error Handling Best Practices
Check HTTP Status Code
4xx: Client error (request needs modification)5xx: Server error (retriable)
Sample Code
Node.js