Skip to content

Checkout ​

The Checkout menu turns a prepared cart into a placed order. It runs as an ordered sequence — set the address, pick a shipping method, pick a payment method, then place the order — and provides queries to read the saved addresses and the available shipping / payment options at each step.

The checkout sequence ​

Checkout must run in order, because each step depends on the one before:

  1. Set the checkout address (billing, and shipping unless the cart is virtual / downloadable only).
  2. Get shipping methods for the saved address, then set the chosen shipping method.
  3. Get payment methods available once shipping is selected, then set the chosen payment method.
  4. Place the order to finalise the cart into an order.

Calling a step out of sequence (for example, fetching shipping methods before an address is saved) fails — finish the previous step first.

Operations ​

OperationGraphQL fieldDescription
Read the checkout addresscollectionGetCheckoutAddressesThe address applied to the active checkout, not the customer's address book.
List shipping methodscollectionShippingRatesRates available for the saved address.
List payment methodscollectionPaymentMethodsMethods available once shipping is chosen.
Set the checkout addresscreateCheckoutAddressSave the billing and shipping addresses on the cart.
Set the shipping methodcreateCheckoutShippingMethodChoose one of the returned rates.
Set the payment methodcreateCheckoutPaymentMethodChoose one of the available methods.
Place the ordercreateCheckoutOrderConvert the prepared cart into an order.

Placing an order has two success shapes. A direct method such as cash on delivery returns the order immediately; a redirect gateway returns redirect: true with a redirectUrl and no order yet — the order is created when the gateway returns. Branch on redirect rather than assuming an orderId is present.

Checkout operates on the cart (identified by its cart token); a guest needs only the storefront key, while a signed-in customer also sends their Bearer token. See Authentication.

Released under the MIT License.