Skip to main content
Want to skip the reading and run it live? Check out our demo app.
This guide shows the full E2E flow - search → cart → checkout → order tracking. You don’t have to use all of it. Jump to whichever feature you need: you can call cart.checkout.purchase directly with a product link, or use products.details standalone without ever touching the cart.

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 a refId so in this example we’ll poll until results arrive.
Cache the refId - you can re-poll any time to retrieve results without re-running the search.

Step 2 - Fetch product details

Use the product link 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 to cart.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

The checkoutUrl 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:
See the Webhooks guide for signature verification and the full list of events. If you need to check order status on demand, use orders.list({cartId}).

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