Make repeated calls to a non-idempotent endpoint safe.
POST /payments
Idempotency-Key: 7f3a-4c21-9b58 (client-generated UUID)
first call: record (key, request, status=in_flight)
process payment
update (key, status=200, response)
retry: find (key); if status=200 -> return cached response
if status=in_flight -> 409 conflict
A receipt stapled to a request: “if you ever see this request again, just give me the answer I already paid for”.
Interview tip: Stripe’s idempotency design is the gold standard. Quote it.