Same Key New Body

A buggy client sends POST /charges with idempotency key abc123 for $50, then retries with the same key but a $500 amount after the user edited the form. What should a well-designed idempotent API do?

A

Overwrite the stored record with the $500 amount and return the amended result, so the most recent client intent wins and the customer is charged what the form showed

B

Reject the second request with an error, because the key is bound to the parameters of the original request and reusing it with a different body is a client bug rather than a retry

C

Process the second request as a brand new charge under a freshly minted key, since the differing amount proves the user intended a distinct operation rather than a retry

D

Replay the stored $50 response without raising an error, since a matching key always identifies an operation the server has already completed and the request body is only advisory on a retry