Walkthrough
1. Interpret
Extract the requested product, variant and quantity; ask when the request is ambiguous.
2. Verify
Read live inventory and quote from the backend; request confirmation before creating checkout.
3. Fulfil
Act on verified payment events and route exceptions to staff.
Worked example
Keep explicit order states so a payment event cannot skip the staff review required for an exception.
Open the example
const nextState = {
awaiting_payment: ["paid", "cancelled"],
paid: ["ready_to_fulfil", "needs_review"],
needs_review: ["ready_to_fulfil", "refunded"],
};