TechniqueFrameworkSoftware engineering
In a distributed system every request may arrive twice, so make the second one harmless
Arpit Bhayani · Build a Robust Payments Service Using Idempotency Keys
The idea
A client sends a payment, the network drops the reply, the client retries, and the customer is charged twice. Arpit Bhayani walks the failure and the two ways to make the repeat safe. The general technique is an idempotency key: the client attaches a unique identifier to the request, the server records the result against it, and a second arrival with the same key returns the stored result instead of acting again. The idea is wider than payments. Any operation that can be retried across a network has to be designed so that doing it twice equals doing it once, because the network guarantees that sometimes it will be.
Design every retryable operation so that doing it twice has the same effect as doing it once; the network will test this for you.
When it works
System design interviews, payment and order systems, and any API that a client might retry.
When it may fail
An idempotency key needs storage with its own consistency guarantees, and a key that expires too soon reopens the hole. The technique moves the problem to a smaller place; it does not remove it.
How to use it
In a system design answer, when you draw a write path, say what happens when the client retries. If the answer is a duplicate, add the key and the stored result, and say where the key lives.
Where it came from
The source’s claim
Arpit Bhayani shows why a payment can repeat when a reply is lost, and the two ways to make the repeat safe, including idempotency keys stored with their results.
What is checked
- Checked against the clip, reviewed 2026-10-16.
- The exact place in the source is located: 4:06 to 11:13.
Connected ideas
Says something similar
Consensus is agreeing on one value when any machine may crash and the network may lieAsk what a consensus protocol assumes about crashes and the network; its guarantee is only as strong as those assumptions.
This idea appears in
The concepts it carries, and how many works in Atlas carry each one.
Put it to work on L3VLUP
Learn the idea
More like this
- Career lessonCareersBook
Networking works when you are useful before you are needy
Lead with something useful to the other person; a request with nothing attached is ignored by anyone worth reaching.
From Never Eat Alone · Keith Ferrazzi
- TechniqueArtificial intelligenceVideo located
Without evaluation you have a demo, not a system
Build the test set before the feature, measure every change against it, and keep a person in the loop where the metric cannot be trusted.
From How to Systematically Set Up LLM Evals · Dave Ebbelaar
- FrameworkSoftware engineeringBook
Complexity is what you must hold in your head to make a safe change
Judge a design by how much a reader must understand to change it safely, and prefer deep modules behind small interfaces.
From A Philosophy of Software Design · John Ousterhout
- ArgumentSoftware engineeringBook
Speed and stability rise together. The trade-off is the myth
The practices that make shipping frequent are the ones that make it safe, so do not trade one for the other.
From Accelerate · Nicole Forsgren, Jez Humble and Gene Kim