Idempotency Keys: The API Pattern That Saves You From Duplicate Payments and Phantom Records
Your user clicks "Pay" and nothing happens. So they click again. Your server processes both requests — and charges the card twice.
This is one of the most damaging bugs you can ship, and it's entirely preventable. The solution has been hiding in plain sight in Stripe's API since 2013: idempotency keys.
What Is an Idempotency Key?
An idempotency key is a unique token the client sends with a mutating request (POST, PATCH, DELETE). The server uses it to guarantee that no matter how many times you send the same request — due to retries, network failures, or impatient button-clicks — the operation only executes once.









