Cross-service order transaction

DesignHard50 minStripe and Amazon style

Your task

Design the transaction model for an order-and-payment flow that spans three independently-deployed services with separate databases: Inventory (reserve stock), Payment (charge card), and Shipping (create shipment). The flow must be atomic in effect, never charge a card without reserving stock, never ship without a successful charge, at 5k orders/sec, with services that can fail or be slow independently, and no shared database. Choose a coordination model (2PC vs saga vs outbox), justify it, describe failure handling, and the central trade-off.

It covers

  • Distributed transactions
  • 2pc
  • Saga