Retries and idempotency
Orbi Payments Gateway retries webhook deliveries to provide reliable event delivery. Because retries can result in the same event being delivered more than once, your integration must process webhook events idempotently.
When Orbi retries a delivery
A delivery attempt is considered successful only when your endpoint responds with an HTTP 2xx status code.
Orbi retries a webhook delivery when any of the following occurs:
- Your endpoint returns a non-
2xxstatus code - The request times out
- The connection cannot be established (DNS, TLS, or other network errors)
Delivery timeout
Orbi uses a default request timeout of 10 seconds per delivery attempt.
If your endpoint does not respond within 10 seconds, the attempt is treated as failed and may be retried according to the retry schedule.
Recommendation
Acknowledge quickly with a2xxresponse and move long-running work to a background job queue.
Retry schedule
Orbi uses an incremental backoff strategy with up to 21 total delivery attempts. Retries start quickly and then increase in delay, eventually retrying at longer intervals.
In practice, the schedule behaves like:
- An initial retry after ~30 seconds
- Followed by retries spaced a few minutes apart
- Then retries spaced 10–15 minutes apart
- Eventually continuing with ~30-minute intervals for later attempts
This approach balances fast recovery from short outages with sustained delivery attempts during longer incidents.
Idempotency
Each webhook delivery includes an idempotency key in the request headers:
x-idempotency-key: <value>
If a webhook delivery is retried, Orbi re-sends the event with the same x-idempotency-key value. Your integration must treat this header as the primary deduplication key.
How to process events safely
A recommended workflow:
- Read the
x-idempotency-keyheader. - Check whether you have already processed this key.
- If it has already been processed, return
2xximmediately. - If it has not been processed:
- Persist the key atomically (or create a unique record keyed by it)
- Process the event
- Return
2xx
Important
Do not rely on timestamps, event types, or payload hashes for deduplication. Always usex-idempotency-key.
Best practices
- Return
2xxonly after the event is safely accepted (for example, persisted or queued). - Avoid long-running work in the webhook handler; enqueue background jobs and respond quickly.
- Log failures and monitor webhook delivery error rates.
- Design handlers to tolerate duplicates and out-of-order deliveries.
Updated 7 months ago