@usethrottle/cart
    Preparing search index...

    Interface CartSessionClientOptions

    Browser client for backend-less cart ownership. Unlike CartClient (which needs a server-side sk_ key), CartSessionClient runs in the browser: it creates and mutates a Throttle cart authorized by a publishable quote token (pk_…, the same token used by StorefrontQuoteClient) plus the application origin allowlist, and an opaque cart_… session id scoped to that one cart.

    Typical use:

    const cart = new CartSessionClient({ applicationId, environmentId, quoteToken });
    await cart.create(); // or cart.resume(savedId)
    await cart.addItem({ name: 'Widget', unitPrice: 2999, quantity: 1 });
    const { checkoutUrl } = await cart.checkout({ returnUrl, cancelUrl });
    interface CartSessionClientOptions {
        applicationId: string;
        baseUrl?: string;
        environmentId: string;
        fetch?: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
        origin?: string;
        quoteToken: string;
        timeoutMs?: number;
    }
    Index
    applicationId: string

    Application UUID.

    baseUrl?: string
    environmentId: string

    Workspace environment UUID the publishable token was minted for.

    fetch?: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>

    Type Declaration

      • (input: RequestInfo | URL, init?: RequestInit): Promise<Response>
      • Parameters

        • input: RequestInfo | URL
        • Optionalinit: RequestInit

        Returns Promise<Response>

    origin?: string

    Origin to send. Browsers set the Origin header automatically (and it can't be overridden from JS), so this is only needed for non-browser callers (SSR, tests). It must be on the application's allowlist.

    quoteToken: string

    Publishable storefront quote token (pk_…).

    timeoutMs?: number