Build reliably
Errors and status codes
The HTTP status tells you what kind of outcome you got; the code field tells you exactly which one. Branch on codes, never on human-readable messages.
Response shapes
| Shape | Where |
|---|---|
PaymentResponse { paymentId, status, code, normalizedCode, declineCategory, message, redirectUrl, correlationId } | Payment operations: success, 402, 409, 502, and business 422s. |
ValidationProblemDetails { title, status, detail?, errors, code? } | Field validation 422s. errors maps field names to messages; code is present when there's a machine-readable reason. |
{ code, message } | Checkout sessions, payment links, webhook endpoints, hosted fields and operator headers. |
{ error, error_description } | POST /api/v1/auth/token (RFC 6749). |
{
"paymentId": "a2d4f6b8-1c3e-4a5b-8d7f-9e0a1b2c3d4e",
"status": "Declined",
"code": "INSUFFICIENT_FUNDS",
"normalizedCode": "INSUFFICIENT_FUNDS",
"declineCategory": "SoftDecline",
"message": "<human-readable reason>",
"redirectUrl": null,
"correlationId": "5d1e2f3a-4b5c-4d6e-8f9a-0b1c2d3e4f5a"
}HTTP status codes
| Status | Meaning | What to do |
|---|---|---|
200 · 201 · 202 | Success, created, accepted. | Check status: Requires3DS or RequiresAction needs the customer at redirectUrl. |
400 | Malformed request (e.g. a bad X-Merchant-Context, or an unreadable token request). | Fix the request. |
401 | Missing, expired or invalid token or credentials. | Get a new token; check credentials. |
402 | Declined by the issuer/PSP, or blocked by a risk rule (RISK_BLOCKED). | Show a decline message; offer another method. Don't retry a hard decline. |
403 | Authenticated but not allowed (permission, merchant context, operator credentials). | Check the token's scope and headers. |
404 | Unknown resource, or one that belongs to another merchant. | Check the id and the credentials you used. |
409 | Conflict: same idempotency key in flight, or the operation doesn't fit the current status. | Re-read the resource; retry later with the same key. |
410 | Expired checkout session or unavailable payment link. | Create a new session or link. |
422 | Validation or business rule (see codes below). | Fix the input or configuration; don't retry unchanged. |
429 | Rate limit exceeded. | Wait for Retry-After, then retry. |
501 | Hosted fields outside the sandbox. | Use hosted checkout. |
502 | No gateway could process the payment (Failed). | Read the payment; retry with a new key only if appropriate. |
Payment result codes
| Code | HTTP | Meaning |
|---|---|---|
RISK_BLOCKED | 402 | A risk rule blocked the payment; a risk event is recorded. |
ROUTING_BLOCKED | 402 | The routing workflow refused the payment (reject or risk-block node). |
decline codes, e.g. INSUFFICIENT_FUNDS | 402 | Business decline. See normalizedCode and declineCategory. |
ROUTING_NOT_CONFIGURED | 422 | No active published workflow for this payment. |
MERCHANT_GATEWAY_NOT_CONFIGURED | 422 | No routable gateway account for this merchant and environment. |
payment.environment_indeterminate | 422 | environment omitted and it can't be resolved from your accounts. |
WORKFLOW_NOT_FOUND · WORKFLOW_NOT_PUBLISHED · WORKFLOW_PAYMENT_METHOD_MISMATCH | 422 | The explicit workflowId can't be honoured. It's never substituted. |
OPERATION_NOT_SUPPORTED | 422 | The selected gateway doesn't support this operation (e.g. purchase, void). |
AMOUNT_LIMIT_EXCEEDED | 422 | Capture above the authorized amount, or refund above the captured amount. |
IDEMPOTENCY_KEY_REUSED | 422 | Same Idempotency-Key, different request. |
IDEMPOTENCY_IN_PROGRESS | 409 | The first request with this key is still running. |
STATE_CONFLICT · OPERATION_IN_PROGRESS | 409 | Not allowed in the current status, or another operation is in progress. |
PAYMENT_NOT_FOUND | 404 | Unknown payment or another merchant's payment. |
ROUTING_FAILED | 502 | No eligible gateway account could process the payment. |
PROCESSING_INTERRUPTED | 502 | Interrupted before reaching any provider. No charge; retry with a new key. |
STATUS_UNKNOWN · REFUND_OUTCOME_UNKNOWN | 200 | Provider outcome not yet confirmed (Pending). Wait for the webhook; don't retry. |
Validation errors
Field errors come back as 422 ValidationProblemDetails. A reused idempotency key uses the same shape with code set:
{
"title": "One or more validation errors occurred.",
"status": 422,
"detail": "This Idempotency-Key was already used with a different request body. Use a new key for a new request.",
"code": "IDEMPOTENCY_KEY_REUSED",
"errors": {}
}amountmust be greater than zero.currencyis required and must be three letters (ISO 4217).cardTokenis required onPOST /payments.channel, when sent, must beweb,mobile,link,apiorrecovery.environment, when sent, must beSandboxorProduction.
Documentation reflects the platform as verified on 3 December 2026. Placeholder hosts and credentials are used throughout; your real sandbox host and keys are provided at onboarding.