API reference
API errors
Stable response envelopes, validation errors, and status codes.
Response envelopes
Successful API responses use success: true, a message, a data object, and the incoming X-Request-ID value when supplied. Errors use success: false, a safe message, an error.code, optional error.details, and request_id.
JSON · validation error
{
"success": false,
"message": "The given data was invalid.",
"error": {
"code": "validation_error",
"details": {"currency": ["The selected currency is invalid."]}
},
"request_id": "request-from-client"
}
Common status codes
| HTTP | Examples | Action |
|---|---|---|
| 200 | Read or idempotent replay. | Use the returned resource. |
| 201 | Payment created. | Redirect to checkout. |
| 401 | invalid_api_key. | Rotate/fix server credentials; do not retry blindly. |
| 404 | payment_not_found. | Check merchant scope and ID. |
| 409 | Idempotency or payment reference conflict. | Do not create a second order until reconciled. |
| 402/422 | Capacity, provider, amount, or validation problem. | Fix configuration or wait for evidence. |
| 429 | Rate limited. | Back off and retry with jitter. |