Architecture
Checkout Flow
How the CheckoutSession state machine manages the payment lifecycle — with dynamic transitions based on fulfillment type.
The CheckoutSession class is a framework-agnostic state machine that orchestrates the complete checkout flow. It enforces valid transitions, emits events, and works identically in Node.js, Edge runtimes, and the browser.
The flow adapts dynamically based on the fulfillment type — sessions that don't need shipping (like POS or digital goods) skip the address step entirely.
State Machine
Checkout Flow
State Machine
Information
👤 Collect Info
📦 Shipping Details
Payment
💳 Process Payment
🔒 Verify & Capture
Result
✅ Order Complete
❌ Payment Failed
Failed → Retry → Payment
Flow:Info→Payment→Complete|Failed
Collection
Payment
Success
Failure
Documentation Asset // COMMERCE_JS_FLOW_01