Skip to content

E-commerce and order management

An e-commerce platform has two halves. The storefront helps customers find products and place orders: catalog, search, pricing, cart and checkout. Order management makes good on those orders: reserving inventory, taking payment, routing to warehouses or stores, shipping, and handling cancellations and returns. The storefront must be fast and survive traffic spikes; order management must be correct, because every mistake is a lost sale, an oversold item or a refund.

Storefront and order management1. Customers browse a cached catalog and search, then build a cart priced with promotions and tax. 2. At checkout, the payment is authorized but usually not yet captured. 3. The order is created and stock is reserved. 4. Fulfillment routing chooses where each line ships from. 5. Payment is captured when items ship; tracking, cancellations and returns follow the order to the end.StorefrontOrder management Catalog and searchcached, read-heavy Cart and checkoutpricing, tax, promotions Payment providerauthorize at order Order serviceorder lifecycle Inventoryreservations Fulfillment routingwarehouse or store Shippingand tracking Returns and refunds12345
Storefront and order management The storefront is optimized for reads and spikes; order management runs a long-lived, event-driven process for each order.
  1. Customers browse a cached catalog and search, then build a cart priced with promotions and tax.
  2. At checkout, the payment is authorized but usually not yet captured.
  3. The order is created and stock is reserved.
  4. Fulfillment routing chooses where each line ships from.
  5. Payment is captured when items ship; tracking, cancellations and returns follow the order to the end.

The order lifecycle is a long-running process: placed, payment authorized, stock reserved, allocated to a location, picked, packed, shipped (payment captured), delivered, and possibly returned and refunded. Model it as an explicit state machine with allowed transitions, and record every change as an event. Most order systems coordinate this with orchestration inside the order domain and publish events for other domains.

Payment: authorize, then capture. Card payments are typically authorized when the order is placed and captured when the goods ship, so customers aren’t charged for items that never arrive. Authorizations expire, so long delays need re-authorization. Every payment call must be idempotent; see Stripe’s idempotency keys.

Inventory and overselling. Available-to-sell is stock on hand, minus reservations, minus safety stock, across warehouses and stores. Reserve at order time (or at checkout for scarce items) with a timeout, and release reservations on cancellation. Flash sales need atomic decrements or a dedicated reservation service, not “check then write”.

Fulfillment routing. With several warehouses, stores and suppliers, an order may be split by line. Routing rules weigh stock, distance, cost and delivery promise. “Buy online, pick up in store” and ship-from-store make stores part of the fulfillment network.

Peak traffic. Sales events bring traffic many times the normal level. Cache the catalog and product pages aggressively at the edge, keep checkout as lean as possible, queue non-urgent work, and protect order management with load shedding or a virtual waiting room rather than letting it fail. Load test at expected peak before the event.

  • Card data: the PCI DSS (opens in a new tab) standard applies to systems that store, process or transmit card data. Using a payment provider’s hosted fields or redirect keeps card numbers out of your systems and shrinks your scope. See data protection.
  • Tax: sales tax and VAT rules vary by location and product, and change often. Most retailers use a tax calculation service.
  • Consumer protection and privacy: rules on pricing display, cancellation rights and personal data vary by country. Confirm what applies in each market.

Pros of separating storefront and order management

Section titled “Pros of separating storefront and order management”
  • Each half scales and changes at its own pace.
  • The storefront can be replaced (new frontend, headless commerce, marketplaces) without touching fulfillment.
  • Order management becomes the single place for order truth across every channel.
  • Overselling from non-atomic stock checks or caches of inventory that are too stale.
  • Capturing payment too early, leading to refunds and chargebacks for unshipped items.
  • No explicit order state machine, so orders get stuck in states nobody can explain.
  • Checkout depending synchronously on every service (recommendations, loyalty, reviews), so any one of them can stop sales.
  • Duplicate orders from retried submissions without an idempotency key.

Written and edited by Abhinav Taduka, enterprise software architect.