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. Usepk_live_... for live data or pk_test_... for sandbox data.
Read data
Resources expose typedlist() and get() methods:
products, variants, orders, customers,
reviews, discounts, upsells, subscriptions, subscriptionOffers,
webhooks, users, checkout, refunds, and plans.
Create products and webhooks
Create subscription offers
UsesubscriptionOffers 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 asproductId:
Manage subscribers
Thesubscriptions 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.
Plans and entitlements
Some features need a paid plan (see Plans and limits). Check what the account can use before you turn one on:plans, users.entitlements(), checkout.abandonedSummary(),
products.setAbandonedCheckout() and FeatureLockedError ship in the next
SDK release. Until you can upgrade, call the endpoints directly:
GET /users/entitlements, GET /users/billing-tiers,
GET /checkout/abandoned/summary and
PATCH /products/{id}/abandoned-checkout (see the
endpoint reference).Handle errors
SDK calls reject when the API returns a non-2xx response:FeatureLockedError (HTTP 403, code FEATURE_LOCKED). Nothing
was saved and a retry will fail the same way: ask the creator to upgrade.