← Lessons

quiz vs the machine

Gold1400

System Design

The Checkout Flow

Turning a cart into a paid order through a reliable multi step pipeline.

5 min read · core · beat Gold to climb

What checkout coordinates

Checkout transforms a cart into a confirmed order. It touches many services: address, inventory, pricing, payment, and order creation. Each step can fail, so checkout must be designed for partial failure.

The typical steps

  • Validate cart: confirm items still exist and stock is available.
  • Compute totals: apply current prices, taxes, shipping, and promotions.
  • Reserve inventory: hold the units so they are not sold to someone else mid checkout.
  • Authorize payment: get the payment provider to approve the charge.
  • Create order: persist the order and confirm to the shopper.

Designing for failure

If payment fails, the inventory reservation must be released. If the order record write fails after a successful charge, you need a reconciliation process or the charge gets refunded. Idempotency keys prevent a retried checkout from charging twice.

Key idea

Checkout is a multi step pipeline where each step can fail, so use reservations, idempotency, and reconciliation to stay correct.

Check yourself

Answer to earn rating on the learn ladder.

1. What should happen to a reservation if payment fails during checkout?

2. Why use idempotency keys in checkout?