Skip to main content

Checkout

The checkout model orchestrates the multi-step process from cart to order: setting addresses, selecting shipping, creating payment sessions, and placing orders. The frontend controls the step flow; the API provides granular actions that can be called in any order.

Checkout Service

The CheckoutService provides methods to complete checkout.

setAddresses

Sets shipping and/or billing addresses on the cart.

setAddresses(
params: SetAddressesParams,
data: SetAddressesBody,
authorization?: string
): Observable<Carts.Model.Cart>

Body Parameters

ParameterTypeDescription
shippingAddressIdstringUse saved address (authenticated users only)
shippingAddressAddressOr provide new address inline
billingAddressIdstringUse saved address (authenticated users only)
billingAddressAddressOr provide new address inline
notesstringOrder notes (optional)
emailstringRequired for guest checkout

setShippingMethod

Selects a shipping option for the cart.

setShippingMethod(
params: SetShippingMethodParams,
data: SetShippingMethodBody,
authorization?: string
): Observable<Carts.Model.Cart>

Body Parameters

ParameterTypeDescription
shippingOptionIdstringID from getShippingOptions()

setPayment

Creates a payment session for the cart.

setPayment(
params: SetPaymentParams,
data: SetPaymentBody,
authorization?: string
): Observable<Payments.Model.PaymentSession>

Body Parameters

ParameterTypeDescription
providerIdstringPayment provider ID (required)
metadataobjectProvider-specific data (optional)

Returns

PaymentSession with redirectUrl (for redirect-based providers) or clientSecret (for embedded payments).

getShippingOptions

Retrieves available shipping options for the cart.

getShippingOptions(
params: GetShippingOptionsParams,
authorization?: string
): Observable<Checkout.Model.ShippingOptions>

Parameters

ParameterTypeDescription
cartIdstringCart ID (required)
localestringFor localized option names (optional)

getCheckoutSummary

Retrieves the full checkout summary (cart with addresses, shipping, payment, totals).

getCheckoutSummary(
params: GetCheckoutSummaryParams,
authorization?: string
): Observable<Checkout.Model.CheckoutSummary>

placeOrder

Creates an order from the cart. Validates that addresses, shipping method, and payment session are present.

placeOrder(
params: PlaceOrderParams,
data?: PlaceOrderBody,
authorization?: string
): Observable<Checkout.Model.PlaceOrderResponse>

Body Parameters

ParameterTypeDescription
emailstringRequired for guest checkout if not set in addresses

completeCheckout

One-shot flow: sets addresses, shipping, payment, and places the order in a single call.

completeCheckout(
params: CompleteCheckoutParams,
data: CompleteCheckoutBody,
authorization?: string
): Observable<Checkout.Model.PlaceOrderResponse>

Body Parameters

ParameterTypeDescription
shippingAddressIdstringUse saved address (authenticated)
shippingAddressAddressOr provide new (required for guests)
billingAddressIdstringUse saved address (authenticated)
billingAddressAddressOr provide new (required for guests)
shippingMethodIdstringShipping option ID
paymentProviderIdstringPayment provider ID (required)
emailstringRequired for guest checkout
notesstringOrder notes (optional)

Data Model Structure

The checkout flow:

  1. setAddresses — Cart must have items first; delegates to Carts.updateCartAddresses
  2. setShippingMethod — Delegates to Carts.addShippingMethod
  3. setPayment — Creates payment session; cart stores paymentSessionId
  4. placeOrder — Validates required data; creates order from cart
  5. completeCheckout — Orchestrates all steps in one call

Types

CheckoutSummary

FieldTypeDescription
cartCartCart with items and metadata
shippingAddressAddressShipping address
billingAddressAddressBilling address
shippingMethodShippingMethodSelected shipping option
paymentMethodPaymentMethodSelected payment method
totalsobjectsubtotal, shipping, tax, discount, total
notesstringOrder notes (optional)
emailstringGuest email (optional)

ShippingOptions

FieldTypeDescription
dataShippingMethod[]Available shipping options
totalnumberTotal number of options

PlaceOrderResponse

FieldTypeDescription
orderOrderCreated order
paymentRedirectUrlstringRedirect URL for payment (optional)