Checkout and order placement
Checkout turns a calculated cart into an order. Hosted checkout starts from the cart’s checkoutUrl; a custom checkout supplies the same required commerce inputs through Storefront mutations.
Completion prerequisites
Before calling cartComplete, use the latest cart to confirm that managed variants remain available, prices resolve, customer or guest contact data is present, required addresses are complete, a valid shipping line is selected when shipping applies, discount codes remain valid, and the configured payment flow has reached its required state.
A payment session belongs to the cart and identifies the configured gateway flow. A payment is the durable payment record; transactions record authorization, capture, cancellation, or refund activity. Initializing a session alone does not prove that funds are secured.
Placement behavior
Thor locks the cart during completion, changes it to ORDERED, copies its commercial snapshot into a new order, verifies that cart and order subtotal and total agree, associates related payment references, commits the order, and then requests inventory reservation for managed lines.
The order preserves product and variant display data, quantities, prices, tax, discounts, addresses, shipping, metadata, store, and payment state. Later catalog changes do not rewrite this snapshot.
Safe recovery
If the completion response is lost, call completion again with the same cart ID or query the cart/order relationship before creating another purchase attempt. When the cart is already ordered, Thor returns the existing associated order. If the cart says ordered but no order is found, the typed discrepancy error requires operational investigation.
Do not create a new cart immediately after a timeout: the first request may already have created the order or provider-side payment.