Charged Twice (idempotency & exactly-once)

A customer at the chai stall pressed pay once and was charged twice, and nothing in the system was broken. This lesson is why that is guaranteed to happen to you, and what to build so it stops.
Before you start. The cut phone line (CAP, done properly) gave you the one fact everything here rests on: a network drops messages, and it drops them silently, so you have to retry. This lesson is the bill for that advice, because a retry means the work can happen a second time.