Tranzak Docs
tranzak.co Dashboard
Docs  /  API reference

Errors and rate limits

The error format of the Tranzak API, every error code with what to do about it, and how rate limits work.

Error format

Failed requests return a JSON body with success: false:

{
  "success": false,
  "error": "validation_error",
  "message": "The given data was invalid",
  "errors": {
    "amount": ["The amount field is required."],
    "currency": ["The currency must be HTG or USD."]
  }
}
Field Description
error A stable code you can branch on.
message A readable explanation. Do not show raw messages to customers unless the table says so.
errors Present on 422: the validation errors by field.

Error codes

HTTP error What to do
401 API key is required / Invalid API key Fix the key you send. Do not retry in a loop.
403 API key is not active / Website not found or inactive Reactivate the key or the website in the dashboard.
403 payment_method_not_approved Live mode only. Request access in Payment methods in the dashboard.
403 events_test_only The events feed needs a test key.
404 transaction_not_found Wrong identifier or reference, or the payment belongs to another website.
422 validation_error / invalid_cursor Fix the request. See errors.
400 payment_method_not_available The method is not enabled for this account.
400 amount_too_low / amount_too_high Change the amount. The message states the limit.
400 payment_processing_failed Show the message to the customer and offer to try again.
503 provider_unavailable The payment network (MonCash, NatCash...) could not be reached. No money was taken. The response has retryable: true and a Retry-After header: wait that many seconds, then create the payment again (a new transaction is created; the failed one is kept with its reason).
429 rate_limit_exceeded / api_key_rate_limit_exceeded / too_many_attempts Wait retry_after seconds.
500 internal_error Retry with a back-off. Check the idempotency note before creating the payment again.

Rate limits

Three limits apply to the API:

Limit Default Error returned
Requests per minute, per IP address 60 429 rate_limit_exceeded
Requests per hour, per API key 10,000 429 api_key_rate_limit_exceeded
Invalid-key attempts per hour, per IP address 10 429 too_many_attempts

The per-minute and invalid-key limits are counted per real client address, not per network provider, so other customers on the same provider do not share your allowance.

Per-minute limit

When you send more than 60 requests in a minute from the same IP address, the API answers 429:

{
  "success": false,
  "error": "rate_limit_exceeded",
  "message": "Too many requests. Please try again later.",
  "retry_after": 60
}

Hourly limit per API key

Each API key may make 10,000 requests per hour by default. Test and live keys have separate counters, and so does every key of the same account. Beyond the limit the API answers 429, and the message states the limit of your account:

{
  "success": false,
  "error": "api_key_rate_limit_exceeded",
  "message": "API key rate limit exceeded. Maximum 10000 requests per hour for this account. Contact Tranzak support to raise it.",
  "retry_after": 1260
}

retry_after is the number of seconds until the allowance is available again. The same counter is used by every gateway/v1 endpoint, including the checkout endpoints used by the WooCommerce plugin.

Need more? The hourly limit is set per account. If your volume requires a higher limit, contact support with your expected volume and we raise it for your account. Your current limit is shown in the Developer section of your dashboard.

Reading your remaining allowance

Authenticated responses carry these headers:

Header Meaning
X-RateLimit-Hour-Limit Your hourly limit for this API key.
X-RateLimit-Hour-Remaining Requests left in the current hour.
X-RateLimit-Limit / X-RateLimit-Remaining The per-minute limit (per IP address) and what is left of it.
Retry-After Seconds to wait. Sent with every 429.

Slow down when X-RateLimit-Hour-Remaining gets low instead of waiting for the 429.

Invalid keys

10 invalid-key attempts per hour from the same IP address answer 429 too_many_attempts. Never retry an invalid key in a loop.

Handling a 429

Wait retry_after seconds, then retry with a back-off. Do not poll faster than you need: a reasonable rhythm for a pending order is once a minute for about 20 minutes, or rely on the webhook instead of polling.

Handling errors well

  • Show customers a simple message. Never show technical details, keys or raw API errors.
  • Log the error code and your own reference to investigate later. Never log keys or secrets.
  • For 500 and network timeouts, read GET /payments/reference/{reference} before you create a payment again, so you never charge twice.