Want to skip the reading and run it live? Check out our demo app.
Prerequisites
- Node.js 18+ (or Bun/Deno)
- An API key from the Henry Dashboard
- A server-side environment (API key must stay private)
Setup
1
Install the SDK
2
Set your environment variable
3
Initialize the client
End-to-end walkthrough
Step 1 - Search for products
Product search is async. The initial call returns arefId so in this example we’ll poll until results arrive.
Step 2 - Fetch product details
Use the productlink from the search result to pull full details: rich images, all variants, and live availability.
Step 3 - Create a cart
Pass one or more product links tocart.create. The response includes a cartId and a ready-to-use checkoutUrl for hosted checkout.
Step 4 - Add more items (optional)
You can add products to an existing cart at any time.Step 5 - Launch hosted checkout
ThecheckoutUrl returned by cart.create points to Henry’s hosted checkout modal. Redirect your user, open it in an iframe, or pop it in a modal - Henry handles payment, address, and tax collection.
Need full control over the checkout UI? See Headless Checkout
Step 6 - Track the order
The recommended approach is webhooks - Henry will POST to your endpoint when the order status changes, so you don’t have to poll. Register a webhook endpoint in the Henry Dashboard, then handle the events:Next steps
Product Discovery
Deep dive: search filters, async polling, and rich product details
Universal Cart
Create, manage, and configure multi-merchant carts
Checkout
Hosted checkout with postMessage events, and Pro headless checkout
Order Management
List, filter, and poll orders across all your users