Safe retries

Environment: Live

Retry temporary failures without creating duplicate financial or messaging operations, and recognise the replies whose outcome is unknown.

# Safe retries

Retry temporary failures without creating duplicate financial or messaging operations, and recognise the replies whose outcome is unknown.

## Retry only transient failures

Network failures, gateway timeouts and selected 5xx responses are candidates for a retry. Validation, authentication and duplicate-reference errors need a change before another request is made. OTP429 means too many one-time-code attempts: wait before trying again.

## When the outcome is unknown

Some replies mean the money may have moved even though you did not get a clean success. Treat these as pending, never as failed, and never as a reason to resend with a new reference.

| Code or situation | What it means | What to do |
| --- | --- | --- |
| TP18 | Network timeout. The payment request may still be sent to the customer. | Do not retry. Wait for the webhook, or check Payment Status with the original externalref. |
| PY02, APY10, APY16, PY01 | The payout service did not give a final answer. | Check Transfer Status by externalref. Do not resubmit. |
| ASL06 | Airtime or data sale with an unknown result. | Check Sales Status with the original reference. |
| HTTP timeout or 5xx | Your request may or may not have been processed. | Resend with the same Idempotency-Key, or check status by reference. |

## Back off and preserve context

Use bounded exponential backoff with jitter. Keep the same external reference, Idempotency-Key, request data, and environment for every retry so reconciliation remains unambiguous.

> **Do not retry blindly:** If the outcome is uncertain after a timeout, check status or await the callback before retrying a financial operation. An Idempotency-Key makes the resend safe, but checking status is still the cleanest way to know.

Back to the Moolre AI documentation index