A client calls your create-payment endpoint, the response is lost to a timeout, and the client retries the request. How would you design the API so the money isn't charged twice?
~4 min by voice
How to approach it
This checks whether you can make a non-idempotent operation (a POST that creates a payment) safe to retry: an idempotency key from the client, atomic recording on the server, correct handling of races, and idempotency along the whole chain, including the external provider.
The interviewer will ask this question and listen. Think out loud and ask for a hint if you need one. When you're done, pause or tap “That's my answer”. In about a minute, your score and the points you covered show up here.