Skip to main content
Every error response has the same shape, so you can handle errors in one place.

Error format

Branch on code and the HTTP status. Log details.friendlyMessage to debug a request, but don’t parse it, because the wording can change. To show an error to your own users, map code to your own text.
See Common error codes for the codes and their statuses.

HTTP status codes

Business limits

Afriex sets limits on your business. A transaction that would take you over a limit returns 403 with BUSINESS_LIMIT_EXCEEDED, and details.friendlyMessage names the limit and the period. A transaction below the smallest amount a limit allows returns 400 with BUSINESS_TRANSACTION_MIN_AMOUNT_NOT_MET. Usage for daily, weekly, and monthly limits resets on a fixed schedule, in UTC: After usage resets, a transaction that went over a daily, weekly, or monthly limit can go through. To ask about your limits, contact support@afriex.com.

Retrying

Retry only the errors that can succeed on a second attempt:
  • Retry: 429, 500, 503, and requests that time out or lose their connection. Treat a 502 or 504 the same way.
  • Don’t retry: the other 4xx errors. They fail the same way until you change the request.
When you retry:
  1. Wait before each attempt, and wait longer each time. For example, start at one second and double the wait, with a little random jitter so many clients don’t retry together.
  2. Use Retry-After when the response has it, instead of your own wait.
  3. Stop after a few attempts, and surface the error.
  4. For POST /transaction, retry with the same meta.idempotencyKey. A retry can never create a second transaction, and a 409 tells you the first attempt went through. See Idempotency.

Request IDs

Every API response, successful or not, carries an x-request-id header. It identifies that one request in Afriex’s logs, including a 503 Afriex returns when the API is briefly unavailable. Log it next to each request you send, so you can find it again when something goes wrong.
Treat it as an opaque string. Each request gets a new one.

Getting help

If a 500 or 503 persists, or a response doesn’t make sense, contact support@afriex.com with the x-request-id of the request. Add the endpoint, the time, and the code you received. For a webhook question, send the event’s id from the webhook body instead. See Webhooks.