Status codes
| Status | Meaning |
|---|---|
200 / 201 | Success |
400 | Malformed request — missing/invalid fields (details in the error message) |
401 | Missing or invalid API key |
404 | Resource not found, or it belongs to another account |
409 | Conflict (e.g. Idempotency-Key reuse with a different body) |
422 | Request understood but not processable (e.g. expired session) |
5xx | SwitchFlow-side failure — safe to retry with the same Idempotency-Key |
Error envelope
Errors return a JSON body with a stable machine-readable code and a human-readable message:error.code, not on message — messages may be reworded.
Common codes
| Code | Where | Meaning |
|---|---|---|
validation_failed | Any endpoint | A request field failed validation |
token_expired | Payment submission | The vault token or session expired — the widget re-collects the card automatically |
session_expired | Payment submission | The payment session passed its expiresAt — create a new session |
Payment outcomes are not HTTP errors
A declined card is a successful API call with a decline outcome — you get200 with status: "DECLINED" and a normalized declineCode, not a 4xx.
Reserve your HTTP-level error handling for integration problems, and read
payment outcomes from the response body and
webhooks.