Idempotency keys, or how to make retries safe
The network failed after the charge but before the response — now what
Key takeaways
- A timeout tells you nothing about whether the work happened.
- Idempotency is a property of the endpoint, not of the client.
- Store the key with the result, not just the key.
A client calls POST /payments . The charge succeeds. The response times out on the way back. The client has no idea whether it worked. If it retries, you might charge twice. If it…