API design · Multiple choice

Two retries with the same idempotency key reach two servers at the same moment. What stops both from charging the card?

hard Databases

Options

Why

"Check, then act" is a race: both servers see no key and both charge. An atomic insert lets the database pick exactly one winner; the loser waits for the winner's result or returns 409 Conflict.

Review this in your daily deck All cards in API design