
π Retail & E-commerce Β· Sequence
What happens when a shopper clicks Pay: stock is reserved, the payment is authorised, the order is created and stock is released again if payment fails.
Drawing diagramβ¦
Checkout sequence: the shopper clicks Pay, the order service asks the inventory service to reserve stock, then calls the payment service which charges the payment gateway. On success the order is saved as confirmed and a confirmation email is sent. On failure the reserved stock is released and the shopper sees a retry option.
sequenceDiagram
actor S as Shopper
participant W as Web Store
participant O as Order Service
participant I as Inventory Service
participant P as Payment Service
participant G as Payment Gateway
S->>W: Click Pay
W->>O: Place order
O->>I: Reserve stock
I-->>O: Reserved
O->>P: Charge Rs 2,499
P->>G: Authorise
alt Payment succeeds
G-->>P: Success
P-->>O: Paid
O->>O: Save order as confirmed
O-->>W: Order confirmed
O-)S: Confirmation email
else Payment fails
G-->>P: Declined
P-->>O: Failed
O->>I: Release stock
O-->>W: Show retry option
endAn online store split into microservices: catalog, cart, orders, payments and search, with Kafka events connecting them to shipping and notifications.
Every status an online order moves through, from placed to delivered, including cancellations, returns and refunds.
A flexible product catalog: categories, products with variants (size, colour), prices, stock per warehouse and images.
How stock stays in sync across stores, warehouses and marketplaces so the same item isn't sold twice.
How an online store handles a return: eligibility, pickup, quality check at the warehouse and the refund or replacement.
How an online store builds 'recommended for you' and 'frequently bought together': click and order data, model training and a fast serving layer.