> ## Documentation Index
> Fetch the complete documentation index at: https://www.commercengine.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

> Drop-in checkout for any website or app. A fully hosted, embeddable checkout experience that handles cart, payments, and order completion.

Commerce Engine Hosted Checkout is a pre-built, embeddable checkout that runs inside an iframe on your site. It handles the entire purchase flow — cart review, authentication, address collection, payments, and order confirmation — so you don't have to build it yourself.

### Why use Hosted Checkout?

* **Ship faster** — skip building cart UI, payment forms, and checkout logic from scratch.
* **Always up to date** — new payment methods, UI improvements, and features are deployed automatically.
* **PCI compliant** — payment data never touches your servers.
* **Framework agnostic** — works with React, Vue, Svelte, Solid, or plain HTML.
* **Store isolation by default** — each store loads from its own subdomain origin, so browser storage is isolated across brands.
* **Zero layout shift** — the iframe loads in the background with no impact on Core Web Vitals.

### How it works

<Steps titleSize="h3">
  <Step title="Install the SDK">
    Add `@commercengine/checkout` via npm, or load `@commercengine/js` from the CDN. The SDK creates a hidden iframe pointing to the hosted checkout app.
  </Step>

  <Step title="Initialize with your credentials">
    Call `initCheckout()` (or `Commercengine.init()` for CDN) with your `storeId` and `apiKey`. The SDK resolves to your store-specific subdomain automatically. The iframe loads in the background and emits a `ready` event when it's prepared.
  </Step>

  <Step title="Configure in Checkout Studio">
    Open Checkout Studio and configure your checkout experience.

    <Card title="Checkout Studio" icon="https://mintcdn.com/tarkai/hIY7_H2biaAvOGu7/favicon.svg?fit=max&auto=format&n=hIY7_H2biaAvOGu7&q=85&s=e6832d305e5128015b7b1e951333b6b0" href="/hosted-checkout/checkout-studio" width="914" height="1000" data-path="favicon.svg">
      Visual configuration app for theme, features, login methods, layout, and payment settings.
    </Card>
  </Step>

  <Step title="Open the checkout">
    Call `openCart()` or `openCheckout()` from a button click. A slide-over drawer appears with the full checkout experience — cart, login, address, payment, and confirmation.
  </Step>

  <Step title="Listen for events">
    The SDK emits events for cart updates, login/logout, order completion, and errors. Use these to keep your UI in sync (e.g., updating a cart badge count).
  </Step>
</Steps>

### Packages

<CardGroup cols={2}>
  <Card title="@commercengine/checkout" icon="npm" href="https://www.npmjs.com/package/@commercengine/checkout">
    Drop-in universal SDK with first-class bindings for React, Vue, Svelte, and Solid.
  </Card>

  <Card title="@commercengine/js" icon="npm" href="https://www.npmjs.com/package/@commercengine/js">
    Vanilla JavaScript SDK. Use directly via npm or load from the CDN at `cdn.commercengine.com/v1.js`. No framework dependency.
  </Card>
</CardGroup>

### Pick your integration

<CardGroup cols={2}>
  <Card title="React" icon="https://svgl.app/library/react_light.svg" href="/hosted-checkout/react">
    `useCheckout()` hook with reactive state. No providers needed.
  </Card>

  <Card title="Vue" icon="https://svgl.app/library/vue.svg" href="/hosted-checkout/vue">
    `useCheckout()` composable returning reactive refs.
  </Card>

  <Card title="Svelte" icon="https://svgl.app/library/svelte.svg" href="/hosted-checkout/svelte">
    Readable stores with `$checkout` syntax.
  </Card>

  <Card title="Solid" icon="https://svgl.app/library/solidjs.svg" href="/hosted-checkout/solid">
    Fine-grained signals via `useCheckout()` primitive.
  </Card>

  <Card title="Vanilla JS / CDN" icon="https://svgl.app/library/javascript.svg" href="/hosted-checkout/vanilla-js">
    Script tag or ES module import. No build step required.
  </Card>

  <Card title="Configuration" icon="code" href="/hosted-checkout/configuration">
    Full reference for all config options, events, and methods.
  </Card>
</CardGroup>
