CloudSketch AI Logo
FeaturesTemplatesPricingEnterpriseAboutContactLog in
πŸŒ™β˜€οΈ
Log inStart free
Home/Templates/Retail & E-commerce

πŸ›’ Retail & E-commerce Β· Sequence

Checkout and Payment 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.

More Retail & E-commerce templates

Opening a template is free and never counts toward your daily diagrams. Asking the AI to change it counts as one.

Drawing diagram…

What this diagram shows

  • Stock is reserved before payment so items don't oversell
  • Failed payments release the reserved stock
  • Confirmation email is sent only after the order is saved

Prompt used

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.

Mermaid code
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
  end

Inside this diagram

A sequence diagram with 6 participants and 15 messages, in the order they happen.

People

  • Shopper

Systems

  • Web Store
  • Order Service
  • Inventory Service
  • Payment Service
  • Payment Gateway

Steps in order

  • 1. Shopper β†’ Web Store: Click Pay
  • 2. Web Store β†’ Order Service: Place order
  • 3. Order Service β†’ Inventory Service: Reserve stock
  • 4. Inventory Service β†’ Order Service: Reserved (reply)
  • 5. Order Service β†’ Payment Service: Charge Rs 2,499
  • 6. Payment Service β†’ Payment Gateway: Authorise
  • 7. Payment Gateway β†’ Payment Service: Success (reply)
  • 8. Payment Service β†’ Order Service: Paid (reply)
  • 9. Order Service β†’ Order Service: Save order as confirmed
  • 10. Order Service β†’ Web Store: Order confirmed (reply)
  • 11. Order Service β†’ Shopper: Confirmation email
  • 12. Payment Gateway β†’ Payment Service: Declined (reply)
  • 13. Payment Service β†’ Order Service: Failed (reply)
  • 14. Order Service β†’ Inventory Service: Release stock
  • 15. Order Service β†’ Web Store: Show retry option (reply)

Conditions and loops

  • If: Payment succeeds
  • Otherwise: Payment fails

Make your own diagram like this

Describe your own system in plain English and the AI sequence diagram generator draws it in seconds, in the same style as this template.

Related templates

C4 ArchitectureProRetail & E-commerce

E-commerce Microservices Architecture

An online store split into microservices: catalog, cart, orders, payments and search, with Kafka events connecting them to shipping and notifications.

State MachineRetail & E-commerce

Order Lifecycle State Machine

Every status an online order moves through, from placed to delivered, including cancellations, returns and refunds.

Database ERDRetail & E-commerce

Product Catalog Database Schema

A flexible product catalog: categories, products with variants (size, colour), prices, stock per warehouse and images.

Data FlowRetail & E-commerce

Omnichannel Inventory Sync

How stock stays in sync across stores, warehouses and marketplaces so the same item isn't sold twice.

FlowchartRetail & E-commerce

Returns and Refunds Workflow

How an online store handles a return: eligibility, pickup, quality check at the warehouse and the refund or replacement.

Data FlowRetail & E-commerce

Product Recommendation Engine

How an online store builds 'recommended for you' and 'frequently bought together': click and order data, model training and a fast serving layer.