Tech
Idempotency Keys - The Double-Charge Trap
The Problem
You click Pay . The server charges your card, but the response is lost on the way back (network drop, timeout, tab freeze). The UI thinks it failed, so you click Pay again and get charged twice .
A timeout means "I don't know what happened" , not "payment failed".
The Idea
Idempotent = doing the same thing twice has the same effect as doing it once.
Action
Repeat it twice
Idempotent?
Set notifications to OFF
Still OFF
Yes ...
Read the full discussion on Dev.to
This article was aggregated from Dev.to. Click to join the conversation.
View on Dev.to