zenydevelopers

Errors

Every error has the same shape. Branch on code, show message to people.

{
  "error": {
    "type": "invalid_request",
    "code": "amount_below_minimum",
    "message": "amount must be at least 10000.00 IDR",
    "param": "amount.value",
    "details": [],
    "requestId": "…"
  }
}
typeHTTPExample codesRetry?
invalid_request400invalid_body, unknown_field, field_required, amount_below_minimumNo, fix the request
authentication401api_key_invalidNo
permission403permission_denied, mode_mismatchNo
not_found404payment_not_foundNo
conflict409duplicate_reference, invalid_state_transition, attempt_in_progress, idempotency_key_in_progressOnly *_in_progress, with the same key
idempotency_error422idempotency_key_reusedNo, use a new key
rate_limit429rate_limitedYes, after Retry-After
provider_unavailable503provider_unavailableYes, with the same key
api_error500internal_errorYes, with the same key

When a request times out or answers 5xx you do not know the outcome. Retry with the same Idempotency-Key, or read the object, before you do anything else.

Declined is not an error

A payer whose bank refuses a payment does not cause an API error. The attempt ends with status failed and a failure.code of declined or processing_error. The payment itself stays pending and can be paid by a new attempt until it expires.