Controls a Checkout Session, including its state, Payment Element, mutations, and confirmation flow.

Failed operations reject with a StripeError. Display its localizedMessage to the customer, falling back to a generic message when it is absent. Its message is diagnostic and isn't intended for customers.

This API is in private preview and can change without notice.

interface CheckoutElements {
    status: "ready" | "updating" | "confirming" | "destroyed";
    session: CheckoutElements.Session;
    paymentElement: null | CheckoutPaymentElement;
    shippingAddressElement: null | CheckoutShippingAddressElement;
    currencySelectorElement: null | CheckoutCurrencySelectorElement;
    expressCheckoutElement: null | ExpressCheckoutElement;
    updateEmail(email: null | string): Promise<void>;
    updateShippingAddress(params: UpdateShippingAddressParams): Promise<void>;
    runServerUpdate(serverUpdate: () => Promise<void>): Promise<void>;
    clearPaymentOption(): Promise<void>;
    clearLocalCustomerData(): Promise<void>;
    confirm(): Promise<CheckoutElements.Result>;
    destroy(): Promise<void>;
}

Properties

status: "ready" | "updating" | "confirming" | "destroyed"

The controller lifecycle status. Disable mutation and confirmation UI unless this is ready.

The latest snapshot of the customer's Checkout Session.

paymentElement: null | CheckoutPaymentElement

The Payment Element, or null when it is not configured.

shippingAddressElement: null | CheckoutShippingAddressElement

The Shipping Address Element, or null when it is not configured.

currencySelectorElement: null | CheckoutCurrencySelectorElement

The Currency Selector Element, or null when unavailable.

expressCheckoutElement: null | ExpressCheckoutElement

The Express Checkout Element, or null when unavailable.

Methods

  • Updates the customer's email address. Pass null to clear it.

    Parameters

    • email: null | string

    Returns Promise<void>

  • Runs a server update, then refreshes the local Checkout Session.

    Parameters

    • serverUpdate: () => Promise<void>

    Returns Promise<void>

  • Clears the customer's currently selected payment option.

    Returns Promise<void>

  • Clears persisted Checkout customer authentication state on logout.

    Returns Promise<void>

  • Releases the controller's native resources and clears its loaded state.

    Returns Promise<void>