Without a key, a network retry can charge the customer twice. With a key, the server stores {key -> response} for, say, 24h and replays the stored response on the second request. Stripe’s pattern is the canonical example. Pair with a write-once guard.
Client sends Idempotency-Key: <uuid> in POST /refunds.
Server stores (key, response_body, status, ts) for 24h; same key returns the stored response.
In-flight dedupe: a SECOND concurrent request with the same key waits for the first to finish.
Keys never reused; expired keys are deletable.
POST + Idempotency-Key
-> server stores (key, response) for 24h
-> retry returns stored response
Idempotency keys are the cheapest insurance against double-charges.