Skip to Content
ePay.lkDocs

Errors

Every error uses one JSON envelope with a stable type and code. Branch on code, show message to developers, log request_id.

Successful requests return 2xx. Anything else returns this body:

{
  "error": {
    "type": "invalid_request_error",
    "code": "parameter_invalid",
    "message": "amount: Too small: expected number to be >0",
    "param": "amount",
    "request_id": "req_7Gd2nQ0vXk"
  }
}
FieldDescription
typeBroad category (below). Stable.
codeSpecific, machine-readable reason. Stable — branch on this.
messageHuman-readable explanation for developers. May change; don't parse it or show it to payers verbatim.
paramThe request field that caused the error, when there is one (e.g. amount, customer.email).
request_idUnique ID of the request. Log it, and include it when you contact support.

Types

typeHTTPMeaningRetry?
invalid_request_error400The request is malformed or a parameter is invalidNo — fix the request
authentication_error401Missing, invalid or wrong-environment API keyNo
permission_error403Valid key, but not allowed (scope, account state)No
not_found_error404The object doesn't exist or isn't yoursNo
conflict_error409The object's current state doesn't allow this actionNo — re-read the object
idempotency_error409 / 422Idempotency-Key in use or reused with a different body409: yes, later · 422: no
rate_limit_error429Too many requestsYes, with backoff
acquirer_error502The acquiring bank failed or timed outYes, with the same idempotency key
api_error500 / 503Something went wrong at ePayYes, with the same idempotency key

Common codes

HTTPcodeWhen
400parameter_invalidA field failed validation — see param
400parameter_missingA required field is missing — see param
400currency_unsupportedThe currency isn't enabled for your account
400invalid_cursorThe pagination cursor is malformed
400idempotency_key_invalidIdempotency-Key longer than 255 characters
400payment_not_refundableRefunding a payment that isn't succeeded/partially_refunded
400refund_exceeds_paymentRefund amount exceeds what's still refundable
401api_key_missingNo Bearer token
401api_key_invalidUnknown, revoked, expired or malformed key
401api_key_environment_mismatchsk_test_ key on production or sk_live_ key on sandbox
401publishable_key_not_allowedA pk_… key was used
403missing_scopeThe key lacks the endpoint's scope
403merchant_not_activeYour business isn't active (production verification pending, or suspended)
404resource_missingNo such object for your account
409payment_not_cancelableCanceling a payment that isn't requires_payment
409idempotency_key_in_useA request with the same key is still being processed
422idempotency_key_reusedSame key, different request body
429rate_limitedSlow down; retry with exponential backoff
503environment_mismatchePay-side configuration safeguard tripped; retry later and contact support if it persists

Handling errors well

  • Retry only what's retryable: network errors, 429, 5xx, and 409 idempotency_key_in_use. Use exponential backoff with jitter (e.g. 0.5 s, 1 s, 2 s, 4 s … capped) and the same Idempotency-Key, so a retried create can't double-charge or double-refund.
  • Don't retry 4xx validation errors — they'll fail the same way.
  • Map param to your form fields when the input came from a user (for example a payment-link amount).
  • Payment declines are not API errors. A declined card doesn't fail any API call: the payment stays requires_payment with failure set and you receive payment.failed. See payment statuses.

On this page