Idempotency key

Idempotency key is a unique value a client sends with a payment or payout request so the server can recognise retries of the same request and return the original result instead of charging or paying out a second time.

Also called: idempotent request, Idempotency-Key header, request deduplication key, unique request ID

Updated

On this page4 sections

How does an idempotency key work?

The client generates a unique key for an operation, such as one payout, and sends it with the request. The server stores the result against the key. If the same request arrives again, for example after a network timeout, the server returns the stored result instead of executing it again. Stripe’s documentation describes saving the status code and body of the first request made with a key, returning the same response to retries, rejecting a reused key with different parameters, and removing keys after at least 24 hours. An IETF draft describes an Idempotency-Key HTTP header for making non-idempotent methods such as POST fault-tolerant.

Why does an idempotency key matter in payments?

Timeouts are ambiguous. A request that times out may have failed, or may have succeeded with the answer lost on the way back. As an illustrative example: a marketplace’s payout service times out on 0.5% of 40,000 monthly seller payouts and resends them. Without keys, some of those 200 resends pay sellers twice, and a completed transfer is hard to recover. With keys, every resend returns the original result.

What are the limits?

Keys work within one server’s memory of them: they expire, and they do not cross providers. They also cannot fix a design that creates a new key on every retry. Pair them with your own unique reference per operation, status checks before rerouting, and idempotent webhook handling.

Where does Omno use it?

Omno’s guidance is to process webhooks idempotently, keyed on the transaction, so a repeated delivery never credits or debits a balance twice, and to keep a payout open until a final status arrives rather than retrying blindly. A merchant reference on every request links Omno’s transaction ID to the merchant’s ledger.

Frequently asked questions

What should an idempotency key look like?

A random value with enough entropy to avoid collisions, generated once per logical operation. Stripe suggests version 4 UUIDs and advises against using personal data such as email addresses as keys. Reuse the same key only when retrying the same request with the same parameters.

Does an idempotency key stop duplicates across two providers?

No. A key protects against repeating a request to the same server. If a payment times out at one provider and is sent to another, the second provider has never seen the key. Check the first attempt's final status before sending the payment anywhere else.

esc
↑↓ to move ↵ to open All results