Make Requests Idempotent
Talk it through out loud with your AI coach.
The problem
- medium
- Pro
A customer's phone loses signal just after tapping pay, the app retries the request, and the customer is charged twice. Explain what idempotency means and how you'd design the payment API so retries are safe.
What a strong answer covers
- What idempotency means in plain words.
- Which HTTP methods are expected to behave that way and why the payment wasn't.
- How a client can mark a request so a repeat is recognised.
- What the server does on seeing a repeat, including two arriving at once.
Common mistake: Telling the app not to retry, which leaves customers unsure whether they paid.
Knowing this is half of it. Saying it clearly out loud is the part the coach helps you practise.
Practise it out loud