Skip to content
We areTOP 1%

Design an e-commerce checkout system

HardConceptMedia & Commerce
Track your progress
First attempt
Re-solve after a few days
Final pass before interviews

Answer

Requirements: convert a cart into an order, reserve stock without overselling, charge the customer exactly once, and stay responsive during flash sales.

  • Services: cart, inventory, order, payment and notification services; each order follows a state machine from created through paid to shipped or cancelled.
  • Inventory: reserve stock with an atomic conditional update that decrements only if enough quantity remains, and release reservations that are not paid within a time limit.
  • Payment: call the payment gateway with an idempotency key so that retries never double-charge, and confirm the outcome through gateway webhooks.
  • Trade-off: instead of one distributed transaction, use a saga, a sequence of local steps with compensating actions such as releasing stock when payment fails; this gives eventual rather than immediate consistency.

More in Media & Commerce

Sign in to track your progress

Your checkboxes, streak and activity heatmap are saved to your account and sync across devices. It is free.
Sign in with email

New here? Create an account