Skip to navigation

Errors and retries

Retry safely without creating conflicting payment attempts
View as Markdown

The API returns JSON errors in a consistent shape:

{
"error": "Unable to process the request"
}
HTTP statusMeaning
400The request is structurally valid but cannot be processed by the selected flow or provider.
422The request body, path parameter, query parameter, or header failed schema validation.
500An unexpected provider, database, blockchain, or service error occurred.

Idempotency keys

Send an idempotency-key header when creating an onramp or offramp. Generate the value once per logical customer transaction and never reuse it for a different payment.

If the client loses the initial response:

  1. Retain the original idempotency key.
  2. Check transaction status using that transaction ID before creating another payment.
  3. Retry transient network failures with exponential backoff and jitter.
  4. Stop retrying automatically when the API returns a validation or business-rule error.

Never generate a fresh idempotency key merely because a client timeout occurred. The original request may already have reached Clixpesa or the payment provider.