From henry
Integrate Henry's agentic-commerce API into an app, agent, or backend. Covers installing @henrylabs/sdk, API keys, cross-merchant product search, universal carts, hosted and headless checkout, async job polling, webhooks, and order tracking. Use whenever the user wants to add shopping, commerce, carts, checkout, or product search to something they are building; asks how to use the Henry SDK, Henry API, or @henrylabs packages; mentions HENRY_SDK_API_KEY or henrylabs.ai; or is building a shopping agent or commerce integration. Read this BEFORE writing any code that calls Henry.
How this skill is triggered — by the user, by Claude, or both
Slash command
/henry:integrateThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Henry gives an application a full commerce stack behind a single API key:
Henry gives an application a full commerce stack behind a single API key:
search any merchant's catalog, build multi-merchant carts, launch checkout,
and track orders. Features are modular — you can call
cart.checkout.purchase directly with a product link, or use
products.details standalone without ever touching a cart.
npm i @henrylabs/sdk (or bun add / pnpm add / yarn add).import HenrySDK from "@henrylabs/sdk";
const henry = new HenrySDK({ apiKey: process.env.HENRY_SDK_API_KEY });
The API key is server-side only. Never expose it in browser or mobile code, and never hardcode it — read it from the environment.
Product search, product details, and checkout operations are async jobs:
the initial call returns { refId, status } immediately, and results arrive
when background work completes. Poll the matching poll* method until a
terminal status, or use webhooks instead of polling.
| Status | Meaning |
|---|---|
pending | Queued, not started yet |
processing | Actively running |
complete | Results are ready in result |
failed | Unrecoverable error — check the error field |
The canonical polling helper (reuse for every async method):
async function pollUntilDone<T extends { status: string; refId: string }>(
initial: T,
poll: (args: { refId: string }) => Promise<T>,
intervalMs = 1000,
): Promise<T> {
let current = initial;
while (current.status === "pending" || current.status === "processing") {
await new Promise((r) => setTimeout(r, intervalMs));
current = await poll({ refId: initial.refId });
}
return current;
}
Cache refIds — you can re-poll any time to retrieve results without
re-running the job.
Search returns products with a link; the link is the cart item
identifier (no separate product ID). cart.create returns a checkoutUrl
immediately — hosted checkout needs no extra setup step.
const search = await henry.products.search({ query: "Nike Air Max", limit: 10 });
const done = await pollUntilDone(search, (a) => henry.products.pollSearch(a));
const first = (done.result?.products ?? [])[0];
const cart = await henry.cart.create({
items: [{ link: first.link, quantity: 1, variant: { size: "10" } }],
});
const { cartId, checkoutUrl } = cart.data;
// Send the user to checkoutUrl — Henry handles payment, address, and tax.
| Mode | How | When |
|---|---|---|
| Hosted | Send the buyer to the checkoutUrl from cart.create (redirect, iframe, popup, or WebView) | Default. Fastest to ship; Henry collects shipping, payment, tax; zero PCI burden |
| Headless | Server-side cart.checkout.purchase with buyer info + tokenized card | Full UI control (e.g. voice agents, native checkout). Requires enablement — contact [email protected] |
Before implementing either mode, read references/checkout-and-environments.md.
Every completed order can generate a commission for the application:
configure commissionFeePercent and/or commissionFeeFixed in the
settings object of cart.create. Henry handles payout calculation and
reporting.
npx -y @henrylabs/mcp@latest) and a remote
OAuth-based MCP server for end-user-facing assistants — see the docs site.failed status and surface the error field.Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub henry-social/skills --plugin henry