Unit 6 — coordinate payment, ledger, and webhooks without 2PC
Distributed Transactions & Sagas
A single payment touches three independent services: authorize the card (Unit 1), post the ledger entry (Unit 2), and emit the webhook (Unit 3). There is no shared database. If the ledger write fails after authorization succeeds, you cannot leave the customer charged with no record — and you cannot hold a global lock across three services while you figure it out.
This unit compares two-phase commit (why it blocks) with the saga pattern (how production systems actually coordinate), and builds a saga executor with compensating transactions.
