Responses, Errors & Retries
Interpret IVB API responses, distinguish request acceptance from payment completion and handle errors without unsafe retries.
Read API success separately from payment success
{
"success": true,
"message": "Query successful",
"data": {}
}data varies by endpoint: it can be an object, array, scalar, or be absent when there is no payload. List endpoints do not all use the same pagination shape. Read the endpoint's response section.
HTTP 200 or 201 with success: true means the request was accepted or read successfully. A payment may still be pending. Verify its transaction status and match the saved reference, amount and currency before fulfilling an order.
Handle errors
API errors use success: false, message, and statusCode. Depending on the failure, they also include errorCode, attemptId, errors, path, method, and a human-readable timestamp. Fields may be absent; infrastructure errors can return non-JSON bodies.
Use a recognized
errorCodefor programmatic decisions. Do not compare free-text messages.Validation can return HTTP
400or422.INVALID_REQUEST_DATAidentifies structured validation failures; the message gives safe field guidance. Do not assumeerrorsis always an array of{field, message}objects.Save your reference, the attempt ID, HTTP status and error code for support. Do not log secret keys, authorization links or full customer payloads.
Treat timestamps in error responses as display text, not an ISO timestamp contract.
ZAR bank payment and payout failures
An initiation error uses errorCode and message. Once a transaction exists, authenticated GET /api/v1/transactions/:id and merchant webhook data use status, failureCode and failureReason. The checkout's public receipt may hide technical diagnostics; use the authenticated endpoint for merchant decisions. Codes are stable Ivorypay identifiers, not raw provider result codes.
COLLECTION_ACCOUNT_NOT_FOUND
Check the customer's bank payment details
COLLECTION_BANK_APP_NOT_REGISTERED
The customer must register for the Capitec banking app
COLLECTION_BANK_LIMIT_EXCEEDED
The amount exceeds the customer's bank limit
COLLECTION_BANK_CONSENT_DECLINED
The customer declined payment approval
COLLECTION_BANK_CONSENT_EXPIRED
The approval request expired; check the saved transaction before another attempt
COLLECTION_BANK_PAYMENT_DECLINED / COLLECTION_BANK_PAYMENT_REJECTED
The bank rejected payment; the customer should contact their bank
COLLECTION_BANK_INSUFFICIENT_FUNDS
The customer's bank account has insufficient funds
COLLECTION_PAYMENT_METHOD_UNAVAILABLE
The payment method is unavailable; contact Ivorypay support
COLLECTION_AUTHENTICATION_ERROR / COLLECTION_INVALID_PARAMETER
The provider request could not be accepted; contact support with the reference
COLLECTION_REFERENCE_ALREADY_USED
Read the original payment; do not automatically create a new reference
COLLECTION_DISPATCH_UNCONFIRMED
Submission is uncertain; reconcile the same reference before another initiation
PAYOUT_BANK_NOT_SUPPORTED
Select a supported payout bank
PAYOUT_BANK_ACCOUNT_NOT_FOUND
Check the recipient's bank and account number
PAYOUT_BANK_ACCOUNT_UNAVAILABLE
The recipient must check whether their account can receive the payout
PAYOUT_INVALID_AMOUNT / PAYOUT_AMOUNT_OUT_OF_BOUNDS
Correct the amount's precision or the applicable payout limit
PAYOUT_PAYOUTS_NOT_ALLOWED / PAYOUT_AUTHENTICATION_ERROR
The provider connection cannot submit this payout; contact support
PAYOUT_PROVIDER_INSUFFICIENT_FUNDS
Provider funding is unavailable; contact support. This does not mean the customer's account is empty
These codes describe the reason, not permission to retry. An uncertain provider response must not be treated as a confirmed failure or success. Always read the saved transaction status before fulfilment or another payment. Webhooks can be redelivered; process the same reference and outcome idempotently, and re-read status if events arrive out of order.
Retry without creating a second payment
A unique reference helps identify an operation. It does not promise that every duplicate POST returns the original response. Some routes reject duplicates. Only use an Idempotency-Key header where the endpoint explicitly documents it.
400 / 422 invalid input
Fix the indicated fields before retrying
401 / 403
Check credential type, environment, account access and any IP restrictions
404
Check the identifier, business and environment
409
Read the existing operation; do not generate a new reference automatically
429
Back off and respect Retry-After if supplied
Timeout, lost connection or 5xx after a payment POST
Treat the outcome as unknown. Check the saved reference before another initiation
Failed read-only GET
Retry with bounded exponential backoff and jitter
If the API returns recovery instructions such as retrySafe, follow that endpoint's recovery contract. A missing field is not permission to retry a money-moving request. A failed payout can still have a reservation pending reconciliation; do not assume funds are immediately available for another payout.
Practical server-side response handling
Last updated