Idempotency means performing an operation multiple times has the same effect as performing it once. It matters because networks are unreliable: when a client sends a request and the response never arrives, it can't tell whether the server processed it. If it retries, a non-idempotent operation might run twice.
The problem
Client ──POST /payments {$100}──▶ Server (charges $100 ✓)
Client ◀────────X (timeout)────── Server (response lost)
Client ──POST /payments {$100}──▶ Server (charges $100 AGAIN ✗ → $200!)
, , and are naturally idempotent, so retrying them is safe. is — this is exactly where duplicate charges and duplicate orders come from.
