Live Examples
Live Examples
Usage
Options
widgetId string *required
Your Widget ID from the Henry Dashboard.
items CartItem[] *required
One or more products to include in the checkout. Each item requires a link (a direct product page URL) and optionally accepts:
| Field | Type | Description |
|---|---|---|
link | string | Direct product URL |
quantity | number | Number of units. Defaults to 1 |
variant | string | Record<string, unknown> | Variant selection, e.g. { size: "10", color: "Black" } |
shippingOption | { id?: string; value?: string } | Pre-select a shipping option |
coupons | string[] | Coupon codes to apply |
metadata | Record<string, unknown> | Arbitrary metadata passed through to orders |
display object
Controls how the widget is rendered.
display.size
| Value | Description |
|---|---|
"full" | Full-width button |
"comfortable" | Standard-sized button with logo and label |
"compact" | Smaller button, good for tight layouts |
"bubble" | Floating circular button |
"direct" | Opens the checkout iframe directly without a button trigger |
display.theme
| Value | Description |
|---|---|
"light" | Light color scheme |
"dark" | Dark color scheme |
"system" | Follows the user’s OS preference |
settings CartSettings
Optional settings that control checkout behavior, commission, and event triggers.
settings.options
| Field | Type | Description |
|---|---|---|
allowPartialPurchase | boolean | Whether the buyer can remove items and check out with a subset |
collectBuyerEmail | "off" | "required" | "optional" | Controls email collection |
collectBuyerAddress | "off" | "required" | "optional" | Controls address collection |
collectBuyerPhone | "off" | "required" | "optional" | Controls phone collection |
settings.commissionFeeFixed
Add a fixed commission fee to every checkout.
settings.commissionFeePercent
Add a percentage-based commission fee (0–100).
settings.events
Fire webhooks or send emails on order state changes.
Events
Use.on() to subscribe to checkout events and .off() to remove a listener.
checkout-complete
Fires when the buyer successfully completes checkout.
| Field | Type | Description |
|---|---|---|
status | string | Final order status |
order | Order | undefined | Order object if available |
checkout-closed
Fires when the checkout modal closes, either by the buyer or programmatically.
Methods
.on(event, callback) → this
Subscribe to a checkout event. Returns the element instance for chaining.
.off(event, callback) → this
Remove a previously registered listener.
.destroy()
Unmount the widget and clean up all event listeners. Call this when navigating away or unmounting a component.
TypeScript
React
Use aref guard to prevent double-mounting in Strict Mode:
Related
Card Element
Embed a secure card input for custom payment flows
Server SDK - Checkout
Build headless checkout flows server-side