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 included in the SDK source’s current v1.2.0 release. If npm still installs an older version in your environment, upgrade when that release is published 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 endpoint details, request schemas, response types, and webhook events, use the interactive API reference.