Reactive Checkout state and controller methods returned by useCheckoutElements.

interface UseResult {
    status:
        | "error"
        | "ready"
        | "updating"
        | "confirming"
        | "idle"
        | "loading";
    session: null
    | CheckoutElements.Session;
    paymentElement: null | CheckoutPaymentElement;
    shippingAddressElement: null | CheckoutShippingAddressElement;
    currencySelectorElement: null | CheckoutCurrencySelectorElement;
    expressCheckoutElement: null | ExpressCheckoutElement;
    error: null | StripeError<ErrorCode>;
    reload(): Promise<void>;
    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>;
}

Properties

status: "error" | "ready" | "updating" | "confirming" | "idle" | "loading"

The current hook or controller lifecycle status.

session: null | CheckoutElements.Session

The latest session snapshot, or null before Checkout is ready.

paymentElement: null | CheckoutPaymentElement

The Checkout-owned Payment Element, or null before Checkout is ready.

shippingAddressElement: null | CheckoutShippingAddressElement

The Shipping Address Element, or null before Checkout is ready or when shippingAddressElement was not configured.

currencySelectorElement: null | CheckoutCurrencySelectorElement

The Currency Selector Element, or null before Checkout is ready or when it is unavailable for the Checkout Session.

expressCheckoutElement: null | ExpressCheckoutElement

The Express Checkout Element, or null before Checkout is ready, when it is not configured, or when no express payment methods are available.

error: null | StripeError<ErrorCode>

The initialization error when status is error; otherwise null. Display its localizedMessage to the customer.

Methods

  • Fetches fresh configuration and replaces the current native controller.

    Returns Promise<void>

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

    Parameters

    • email: null | string

    Returns Promise<void>

  • Runs a server update and 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>