Same Key Different Amount

A checkout service posts a charge with an idempotency key. The connection drops with no response. Before retrying, the app re-runs pricing and a coupon has since applied, so the retry carries the same key and a different amount.

POST /v1/charges HTTP/1.1
Host: api.stripe.com
Idempotency-Key: 4f8b1c2e-77a1-4d3e-9c05-2f1ab6d9e410
Content-Type: application/x-www-form-urlencoded

amount=4200&currency=usd&customer=cus_92
POST /v1/charges HTTP/1.1
Host: api.stripe.com
Idempotency-Key: 4f8b1c2e-77a1-4d3e-9c05-2f1ab6d9e410
Content-Type: application/x-www-form-urlencoded

amount=3780&currency=usd&customer=cus_92

The first request had already begun executing server-side. What does the second request return?

A

The stored $42.00 result, unless 24 hours have passed, in which case the key has been pruned and a fresh $37.80 charge is created

B

An error, because the idempotency layer compares the incoming parameters against the original request and refuses when they differ

C

The stored $42.00 result, replayed byte for byte, because a matching key always returns the first response

D

A new $37.80 charge, because the parameters changed and the key only guards against exact duplicates