tutorials35 min read
The App Said "Payment Failed" and the Card Was Charged Four Times: Retries, Idempotency Keys and a Unique Constraint
Customers get four orders, four card authorizations and four confirmation emails for a single purchase, while the app tells them the payment failed. We trace why a timed-out request keeps running on the server, the Idempotency-Key header the API ignores, and the key + unique constraint + 409/Retry-After fix that collapses retries into a single order.