OuiPay
Errors

HTTP Status Codes

What each HTTP status code means in the OuiPay API and how to handle it.

Error shape

Every non-2xx response uses the same envelope:

{
  "error": {
    "code": "INSUFFICIENT_FUNDS",
    "message": "The wallet balance is insufficient for this payment.",
    "request_id": "OUI-REQ-01M2S18..."
  }
}
  • code: machine-readable, stable. Branch on this, never on message.
  • message: human-readable, may change. Safe to display to operators, not for programmatic handling.
  • request_id: quote it to support. It traces the request end to end.

Status code reference

StatusCategoryMeaningYour action
200SuccessRequest succeededProcess the response
201CreatedResource createdProcess the response
400ValidationInvalid field or malformed requestFix the request
401AuthenticationMissing, malformed, or revoked API keyFix the key
403Authorization / policyValid key, disallowed IP, scope, or PIN neededCheck scope, IP, or prompt PIN
404Not foundResource does not existCheck the id
409ConflictDuplicate or invalid state transitionCheck current state
422Business rule violationFunds, limits, compliance, or method issueRead error.code, act
429Rate limitedToo many requestsBack off, retry later
500Internal errorOuiPay infrastructure issueRetry; quote request_id
502Provider errorUpstream payment provider failedRetry-safe via idempotency

A 4xx is still a transaction

A failed attempt leaves a failed transaction entry: with status: "failed", failure.code, and failure.stage recording where it stopped. Query it:

curl https://api.ouipay.com/v1/transactions/01M2S18... \
  -H "Authorization: Bearer sk_test_..."

This means a rejected payment is never "lost": it is on record, with the exact reason.

Retrying safely

  • 5xx / timeout: retry with the same Idempotency-Key. The original response returns; you cannot double-charge.
  • 4xx business rule: do not retry; the failure is final for that request. Fix the cause (insufficient funds, limit, compliance) and submit a new request with a new idempotency key.
  • unknown status: never retry. Wait for the webhook or poll status; the outcome is being reconciled.

On this page