NPM Package
@commercengine/checkout
React integration for Commerce Engine Checkout.
Installation
Setup
CallinitCheckout once at your app’s entry point. This creates a hidden iframe in the background — it does not block rendering. The SDK resolves the hosted URL from storeId + environment using store-specific subdomains.
App.tsx
initCheckout should be called once at the top level of your app, outside of any component. It is safe to call in SSR environments — it no-ops on the server.Feature flags, login methods, drawer direction, and payment provider are managed in Checkout Studio (Config API), not as SDK init options. Use
theme only for per-session overrides.Use the hook
useCheckout() returns reactive state and action methods. No context provider is needed.
CartButton.tsx
Full example
App.tsx
Next.js
For Next.js, callinitCheckout in a client component:
providers.tsx
layout.tsx
useCheckout() in any client component as usual.
Syncing external auth
If your app manages its own authentication, pass tokens to keep checkout in sync:authMode: "provided" in the init config when using external auth:
Hook API reference
useCheckout() returns: