Skip to main content
The official pocketsflow package is a server-side Node.js and TypeScript client for the Pocketsflow API. It uses the same API-key authentication and endpoint shapes documented in the API reference.

Install from npm

Add the SDK to a Node.js or TypeScript project.

View the source

Browse the SDK source, types, examples, and release history.

Installation

Initialize the client

Create an API key in Developers → API keys and keep it on your server. Use pk_live_... for live data or pk_test_... for sandbox data.
Never expose an API key in browser code, a mobile app, a public repository, or a URL. Call the SDK from a trusted server or server-side function.

Read data

Resources expose typed list() and get() methods:
The main namespaces are products, variants, orders, customers, reviews, discounts, upsells, subscriptions, subscriptionOffers, webhooks, users, checkout, and refunds.

Create products and webhooks

Create subscription offers

Use subscriptionOffers for the recurring products you sell. Use subscriptions for the buyers who hold those offers; they are different resources.
frequency must be weekly, monthly, or yearly. The required fields are name, price, and frequency; the SDK also supports the optional offer fields defined in its TypeScript types.
subscriptionOffers.create is available in SDK v1.2.0 and later. If your installed version predates that release, upgrade or call POST /subscriptions directly until then.

Create checkout sessions

Pass either a one-time product id or a subscription-offer id as productId:

Manage subscribers

The subscriptions namespace manages buyer subscriptions and supports listing, retrieval, cancellation, and refunds. The subscriber-specific lifecycle methods are also available through the API endpoints documented in the subscriptions quickstart.

Handle errors

SDK calls reject when the API returns a non-2xx response:
For method signatures, parameter tables, and SDK types, see the Node.js SDK reference. For HTTP endpoint details, request schemas, response codes, and webhook events, use the REST endpoint reference or the interactive API explorer.