October 21, 2026 · 1 min read
Idempotence: tap twice, pay once
An operation is idempotent when repeating it does not change the result. The example of a payment sent twice by mistake.
- tech
- basics
You pay 20 € from your phone. The page is slow, so you tap again. The request goes out twice. And if nothing is in place, you are charged twice: -20 €, then another -20 €.
The word: idempotence
An operation is idempotent when repeating it gives the same result as doing it once. "Set the blind to 50%" is idempotent: do it ten times, the blind is at 50%. "Lower the blind by 10%" is not.
On a network, requests are often repeated: a double click, a connection that drops and retries, a service that retries by itself. A payment has to survive that.
The fix: a key sent with the request
Each request goes out with a unique key (an idempotency key). The server records it when it processes the payment. If the same key comes back, it does not start again: it returns the result it already has. The account is charged once, and the phone shows the green check.
Remember
In a system where requests can be replayed, make them idempotent: one key per request, remembered on the server side.