Idempotency means an operation can be called multiple times with the same result. Charging a credit card is NOT idempotent (charge twice = double charge). Creating a user with "create if not exists" IS idempotent (call twice = one user). Critical for payments, APIs, and any operation that could be accidentally retried. Implement with idempotency keys—client sends unique ID, server checks "already processed this ID?"
Make operations idempotent when they involve money (payments, refunds), when network failures could cause retries, when users might click "submit" multiple times, or in distributed systems where messages might be delivered twice. All payment APIs (Stripe, PayPal) require idempotency keys. Essential for reliability, prevents duplicate charges/orders/emails.
System Design Patterns
Same request = same result