The reply gets lost. Your screen still says loading.
You tap Pay again.
The shop sees a new request and charges another 20 dollars.
You are charged 40 dollars for one order.
Retries happen, so repeat requests must be safe.
Make one unique key per action, and reuse it on retries.
A repeat gets the saved result, not a second effect.
Reach for it when
On anything that charges money or creates an order, since a flaky connection makes people tap Pay twice. Reads are already safe.
The catch
The server must store every key and its saved result for a while, and a retry racing the first request needs care.
Say it in an interview“I would make the payment endpoint idempotent: the client sends a unique key, the server stores the result under it, and any retry returns that same result.”