NuruPay Docs

Errors

Error format and codes.

Errors use standard HTTP status codes and one JSON shape:

{
  "error": {
    "type": "invalid_request_error",
    "code": "invalid_phone",
    "message": "phone must be a valid Tanzanian mobile number",
    "param": "phone",
    "request_id": "req_01M3P44HNMABSHMWA98XWDH8XP"
  }
}
  • Branch on code (stable). message is for humans and may change.
  • param names the field at fault, when there is one.
  • Quote request_id (also in the X-Request-Id header) when contacting support.
StatustypeCommon codes
400invalid_request_errorinvalid_phone, unsupported_currency, unsupported_channel, invalid_reference, invalid_metadata, invalid_json, idempotency_key_required, invalid_idempotency_key, invalid_limit
401authentication_errorinvalid_api_key, api_key_expired
403permission_errorlive_mode_not_enabled, merchant_suspended, ip_not_allowed
404invalid_request_errorresource_not_found
409invalid_request_errorduplicate_reference, idempotency_key_reused, idempotency_request_in_progress
422invalid_request_erroramount_too_small, amount_too_large, unsupported_channel (network not detected from the number)
429rate_limit_errorrate_limited
500api_errorinternal_error: safe to retry with the same idempotency key

A payment that is declined is not an HTTP error: the collection is returned normally with status: "failed" and a failure_code.

failure_codeMeaning
insufficient_fundsNot enough money in the customer's wallet.
customer_cancelledThe customer rejected the PIN prompt.
customer_timeoutThe customer did not respond in time.
invalid_accountThe number cannot receive this payment.
account_not_registeredThe number is not registered for this network's mobile money.
limit_exceededThe amount exceeds a wallet or network limit.
provider_rejectedThe network declined the payment.
provider_unavailableThe network was unavailable.