System Design · Middle · Question 20 of 75
How do you safely retry a payment request after a network error?
- ✓Correct answer: Send an idempotency key with every attempt
- 2Retry until a response arrives, without any extra data
- 3Never retry: ask the user to fill out the form again
Explanation
On a timeout you don't know whether the request got through. The key (Idempotency-Key) is generated by the client per operation; when the server sees a retry, it returns the stored result. This is how Stripe and many payment APIs work.