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

πŸ›’ Retail & E-commerce Β· State Machine

Order Lifecycle State Machine

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

More Retail & E-commerce templates

Drawing diagram…

What this diagram shows

  • Cancellation is allowed only before the order ships
  • Returns open a refund once the item is received back
  • Failed deliveries retry before returning to the warehouse

Prompt used

State machine for an e-commerce order: Placed, Paid, Packed, Shipped, Out for delivery, Delivered. It can be Cancelled before it ships. A failed delivery retries up to 3 times, then goes back to the warehouse (RTO). A delivered order can be returned within 7 days, which leads to Refunded.

Mermaid code
stateDiagram-v2
  [*] --> Placed
  Placed --> Paid: Payment received
  Placed --> Cancelled: Payment failed
  Paid --> Packed
  Paid --> Cancelled: Customer cancels
  Packed --> Shipped
  Packed --> Cancelled: Customer cancels
  Shipped --> OutForDelivery
  OutForDelivery --> Delivered
  OutForDelivery --> DeliveryFailed
  DeliveryFailed --> OutForDelivery: Retry (max 3)
  DeliveryFailed --> ReturnedToWarehouse
  Delivered --> ReturnRequested: Within 7 days
  ReturnRequested --> Refunded: Item received back
  Cancelled --> Refunded: If paid
  Delivered --> [*]
  Refunded --> [*]
  ReturnedToWarehouse --> [*]

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.

SequenceRetail & E-commerce

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.

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.