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:
display object
Controls how the widget is rendered.
display.size
display.theme
prefill object
Optional. Pre-fills the buyer’s details in checkout. All prefill.address fields are optional strings: firstName, lastName, email, line1, line2, city, province, postalCode, countryCode, and phone (E.164, e.g. +15555555555).
settings CartSettings
Optional settings that control checkout behavior, service fees, and event triggers.
settings.options
settings.serviceFeeFixed
Add a fixed service fee to every checkout.
settings.serviceFeePercent
Add a percentage-based service 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 places the order. The purchase itself settles afterwards — read order.status, or use webhooks, for the outcome.
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
Create the widget in an effect and destroy it in the cleanup. This also handles Strict Mode’s double mount:Related
Card Element
Embed a secure card input for custom payment flows
Server SDK - Checkout
Build headless checkout flows server-side