What is idempotency?
Answer out loud or in your head first, then compare.
Answer
Idempotency means that repeating the same operation doesn't cause another, additional effect. For example, setting a status to “completed” again may change nothing. On the other hand, repeating “add 10” without extra protection increases the value a second time.
With a payment API or a queue you usually use an identifier for one intent. If the same request comes back with the same identifier, the system recognises the repeat and doesn't create a second payment. This isn't about blocking two different purchases by the same person. So the key is deciding what “the same operation” really means and how long we keep that information.
Why it matters: One of the most important topics for a system that performs actions.
Possible follow-ups: Why does generating a new ID on every retry destroy the duplicate protection?
How did it go? Be honest — “Not yet” puts the question on your review list.
Related questions
- REST: GET, POST, PUT, PATCH and idempotency — General Web
Practise in code
- Sensible request retries — runs tests in your browser
- Find the bugs in a queue consumer — guided self-review
Further reading
- AWS: Using Lambda with Amazon SQS(opens in a new tab)Docs; accessed 22.10.2026. Polling, batches, duplicates and partial batch responses.