An idempotent operation is one where calling it multiple times has the same effect as calling it once. The HTTP specification treats PUT and DELETE as idempotent by design, which is why Stripe's engineers point out that a PUT to create a DNS record can be replayed safely: the server sees the duplicate and responds successfully without creating a second record (Stripe engineering). A charge is different. Calling a "create charge" endpoint twice creates two charges, and that is a real customer problem, not a rounding error.
An idempotency key narrows the gap. The client attaches a unique value to one business operation, and the server records that value alongside the result. If the same value arrives again, the server returns the recorded result instead of executing the operation a second time. The tutorial version of this idea frames it precisely: a timeout means "I don't know what happened," not "payment failed," so the client keeps the key and retries until it gets a definitive answer (The Double-Charge Trap).
That framing matters because it tells you what the key is not. It is not a lock, not a rate limiter, and not a substitute for a payment provider's own deduplication. It is a memory of intent, stored server-side, that survives network failures the client cannot observe.
The failure modes you are defending against are ordinary. A user double-clicks Pay. A mobile connection drops after the server commits but before the response arrives. An API gateway retries on a 504. A queue consumer processes the same event twice. As the same tutorial notes, in payment systems duplicate requests are expected rather than exceptional, so the backend must assume the same request can arrive more than once (The Double-Charge Trap).



