System Design Drill Day 12: The Saga Pattern for a Multi-Step Checkout
How sagas replace distributed transactions with local steps and compensations, using a multi-step checkout as the example.

How sagas replace distributed transactions with local steps and compensations, using a multi-step checkout as the example.

Why writing to the database and pushing to a queue can't be atomic, and how a transactional outbox fixes lost and phantom events.

How circuit breakers, timeouts and bulkheads keep a checkout alive when the payment gateway or SMS provider starts failing.

Why retries make duplicates inevitable, and how idempotency keys stop double charges and double stock decrements.

How distributed locks work with Redis SET NX EX, why leases and fencing tokens matter, and where locks fit in a checkout.
