Pocketsflow
HumanAgent

Payment infrastructure you program, for software and digital products.

A REST API, a typed SDK and a signed webhook for every event. Open a checkout from your backend, issue license keys, bill by seat or by usage, and let your AI agent do the rest over MCP. We are the merchant of record on every sale, for 2% plus card processing and no monthly fee.

Works with
Developers, API Reference: base URL api.pocketsflow.com, bearer authentication with live and test keys, and resource groups for products, orders, payments, and subscriptions and subscribersDevelopers, API Reference: base URL api.pocketsflow.com, bearer authentication with live and test keys, and resource groups for products, orders, payments, and subscriptions and subscribers

How do I add payments, tax and license keys to my app?

Pocketsflow gives developers a REST API, a typed SDK and a signed webhook for every event: open a checkout from your backend, issue license keys, and bill by seat or by usage. It is the merchant of record, so tax is handled, for 2% a sale plus card processing and no monthly fee.

Best for
Developers selling SaaS, AI apps or software licenses who want payments and tax in a few API calls.

Take your first payment in three steps.

Test keys never charge a real card, so you can run the whole flow before you go live.

  1. Install the SDK

    The package is typed and runs on Node and edge runtimes.

    npm install pocketsflow
  2. Create an API key

    In the dashboard, open Developers → API keys. A pk_test_ key reads and writes test data only; a pk_live_ key, live data.

    POCKETSFLOW_API_KEY=pk_test_...
  3. Open a checkout

    Create a session on your server and send the buyer to its url. Tax, fraud checks and the receipt are handled, then order.completed reaches your webhook.

    POST /checkout/sessions → 201 { id, url }
import { Pocketsflow } from "pocketsflow";

const pf = new Pocketsflow({ apiKey: process.env.POCKETSFLOW_API_KEY });

// Your "Buy" button posts here.
export async function POST(req: Request) {
  const { email } = await req.json();

  const session = await pf.checkout.create({
    productId: "665f1c2a9b3e4a0012ab34cd",
    successUrl: "https://example.com/welcome",
    cancelUrl: "https://example.com/pricing",
    customerEmail: email,
  });

  // The hosted checkout. Send the buyer there.
  return Response.json({ url: session.url });
}

One REST API for everything in the dashboard.

Products, checkout, orders, payments, subscribers, discounts, refunds and webhooks are all endpoints. The dashboard and your code read the same data.

Base URL
HTTPS only, no version prefix in the path.
api.pocketsflow.com
Authentication
A Bearer API key. The key decides the mode: pk_test_ is always test data, pk_live_ always live.
pk_live_ · pk_test_
SDK
The official typed client, published on npm and mirrored on GitHub.
npm i pocketsflow
OpenAPI
The full spec, to import into Postman or generate a client in your language.
/docs.json
Rate limit
Per account. Every response carries RateLimit headers; a 429 says when to retry.
600 / min

A key per integration

Name a key for each server, script or agent, give it an expiry if you want one, and revoke it on its own. Keys are stored hashed, and a revoked key answers 401 on its next call.

Developers, API Keys: Production server, Captionly backend, MCP: Claude, Zapier sync and Staging keys with masked values, created date and Active statusDevelopers, API Keys: Production server, Captionly backend, MCP: Claude, Zapier sync and Staging keys with masked values, created date and Active status

A signed webhook for every sale, renewal and refund.

Subscribe an HTTPS endpoint to any of 50 events. Each delivery is signed with HMAC-SHA256 over a timestamp and the raw body, carries an evt_ id that stays the same on every retry, and lands in a delivery log you can replay from.

Signature
X-Pocketsflow-Signature-V2: t=<seconds>,v1=<hex>. Reject anything older than five minutes.
HMAC-SHA256
Retries
A 5xx, a 429 or a timeout is retried with the same event id: about 10 s, 1 min, then 5 min apart.
4 attempts
Timeout
Answer 2xx fast and do the work in the background.
15 s
Test mode
An endpoint made in test mode only receives events from test sales.
pk_test_
app/api/webhooks/pocketsflow/route.tsWebhook
import { createHmac, timingSafeEqual } from "node:crypto";

const SECRET = process.env.POCKETSFLOW_WEBHOOK_SECRET!;

export async function POST(req: Request) {
  const raw = await req.text(); // the exact bytes, before any parsing

  // X-Pocketsflow-Signature-V2: t=<unix seconds>,v1=<hex>
  const header = req.headers.get("X-Pocketsflow-Signature-V2") ?? "";
  const { t = "", v1 = "" } = Object.fromEntries(
    header.split(",").map((part) => part.split("=", 2)),
  );
  const expected = createHmac("sha256", SECRET)
    .update(`${t}.${raw}`)
    .digest("hex");
  const fresh = Math.abs(Date.now() / 1000 - Number(t)) < 300;

  if (!fresh || v1.length !== expected.length ||
      !timingSafeEqual(Buffer.from(v1), Buffer.from(expected))) {
    return new Response("invalid signature", { status: 400 });
  }

  const event = JSON.parse(raw); // { id: "evt_…", type, created, … }
  if (await alreadyHandled(event.id)) return new Response("ok");

  switch (event.type) {
    case "order.completed":
      await grantAccess(event.customer.email);
      break;
    case "customer.subscription.deleted":
      await revokeAccess(event.customer.email);
      break;
  }
  return new Response("ok");
}
All 50 events
Orders
  • order.completed
  • order.refunded
  • order.post_purchase_accepted
Customers and reviews
  • customer.created
  • review.created
  • testimonial.submitted
Products
  • product.created
  • product.updated
  • product.deleted
Subscriptions
  • customer.subscription.created
  • customer.subscription.updated
  • customer.subscription.pause
  • customer.subscription.resumed
  • customer.subscription.trial_will_end
  • customer.subscription.deleted
  • payment_intent.succeeded
  • payment_intent.payment_failed
  • invoice.created
  • invoice.upcoming
  • invoice.payment_succeeded
  • invoice.payment_failed
  • subscription.upgraded
  • subscription.upgrade_failed
Retention
  • subscription.payment_failed
  • subscription.recovered
  • subscription.saved
Usage billing
  • usage.recorded
  • usage.period_closed
Credits
  • credit.granted
  • credit.balance_changed
  • credit.auto_refill.succeeded
  • credit.auto_refill.failed
  • credit.top_up.succeeded
  • credit.top_up.failed
  • credit.consent.enabled
  • credit.consent.disabled
Payment plans
  • installment.paid
  • installment.failed
Memberships
  • member.joined
  • member.left
Courses
  • course.completed
  • certificate.issued
Payouts
  • payout.created
  • payout.updated
Growth
  • funnel.lead
  • ab_test.completed
  • affiliate.tier_changed
  • loyalty.credit_redeemed
  • split.created
  • split.paid

Every delivery, logged

Each attempt is recorded with its status and the exact JSON your server received. Re-send one with a click, or with POST /delivered-webhooks/{id}/redeliver.

Webhook delivery logs: order.completed, credit.balance_changed, customer.subscription.created, invoice.payment_succeeded, order.refunded (failed), credit.auto_refill.succeeded and more, with endpoint, webhook, time and statusWebhook delivery logs: order.completed, credit.balance_changed, customer.subscription.created, invoice.payment_succeeded, order.refunded (failed), credit.auto_refill.succeeded and more, with endpoint, webhook, time and status

License keys for apps, plugins and desktop tools.

Switch on license keys for a product and every sale gets its own key, like 7KQ2M-X9D4R-T3VWB-8HNPC. The buyer finds it in the receipt, you find it on the order and in the order.completed webhook, and your software checks it with three public POST endpoints. No API key ships inside your app.

/licenses/activate
When the user enters the key. Counts one seat for this install.
201 · 409 at the limit
/licenses/validate
On every launch. Answers valid: false with a code when the key is off.
200
/licenses/deactivate
When the user signs out of a device. The seat is free again.
200
license.tsLicense check
const PRODUCT_ID = "665f1c2a9b3e4a0012ab34cd";

// Public endpoints: no Authorization header, safe to call from your app.
async function license(
  action: "activate" | "validate" | "deactivate",
  licenseKey: string,
  instanceId: string,
) {
  const res = await fetch(`https://api.pocketsflow.com/licenses/${action}`, {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({ productId: PRODUCT_ID, licenseKey, instanceId }),
  });
  return res.json(); // { valid, status, code, activationsRemaining, … }
}

// When the user enters their key:
const activation = await license("activate", userKey, deviceId);
if (!activation.valid) showError(activation.message);

// On every launch:
const check = await license("validate", savedKey, deviceId);
if (!check.valid) lockApp(check.code); // e.g. "license_disabled"
License keys in the docs

Charge per seat or per unit of usage.

Put seats and up to five meters on a subscription offer, then report usage as it happens. When the period ends we price what went over the included units, charge it once to the card on file and send usage.period_closed with the totals.

Per seat
Buyers pick seats at checkout. Optionally issue a license key whose activation limit follows the seats.
1 to 10,000
Meters
Per unit, graduated or volume tiers, with free units included each period.
up to 5
Idempotency
Send an Idempotency-Key and a retried report counts once, even when retries race.
replayed: true
Money
Integer cents in your account currency, never floats.
unitAmountCents
terminalReport usage
# 250 API calls for one subscriber, counted once even if retried.
SUB=665f1c2a9b3e4a0012ab9911
curl -X POST https://api.pocketsflow.com/subscriptions/$SUB/usage \
  -H "Authorization: Bearer $POCKETSFLOW_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: req_8f2a91" \
  -d '{ "meter": "api_calls", "quantity": 250 }'

# 201 Created
# { "usageRecord": { "meter": "api_calls", "quantity": 250, … },
#   "period": { "start": "2026-09-28T09:00:00.000Z", … },
#   "replayed": false }

Usage billing is on every plan, including Free. Selling prepaid credits instead? Deduct from a buyer's balance with POST /credits/deduct.

Usage billing API

Your agent calls the same API.

The MCP server exposes 305 tools over streamable HTTP with OAuth 2.1. Claude, ChatGPT, Cursor, Gemini CLI or an agent you build signs in once, and then creates products, opens checkouts, reads orders and manages webhooks with your permissions. Payment refunds stay in the dashboard.

mcp.jsonAny OAuth MCP client
{
  "mcpServers": {
    "pocketsflow": { "url": "https://www.pocketsflow.com/mcp" }
  }
}
Connect Claude to Pocketsflow consent screen: signed in as maren@northlight.studio, it will be able to create and edit products, read sales, orders and customers, set refund policies, send newsletters and manage discounts, with Cancel and Allow accessConnect Claude to Pocketsflow consent screen: signed in as maren@northlight.studio, it will be able to create and edit products, read sales, orders and customers, set refund policies, send newsletters and manage discounts, with Cancel and Allow access

What you do not have to build.

Pocketsflow is the merchant of record: the legal seller on each order. The parts of payments that are not your product stay with us.

Sales tax and VAT
Worked out at checkout from the buyer's country, collected and remitted.
Fraud and chargebacks
Every payment is screened, and chargeback disputes are ours to fight.
Receipts and invoices
Sent to the buyer on every charge, with the tax shown.
Payouts
Every sale, renewal and overage lands in one balance you withdraw.
How the merchant of record works

Everything else you need.

Questions

Does Pocketsflow have an API?

Yes. One REST API covers everything in the dashboard, with a typed SDK (npm install pocketsflow) and a signed webhook for every sale, renewal and refund. The API is on every plan, including Free.

Can I test payments without charging a real card?

Yes. The key decides the mode: a pk_test_ key only reads and writes test data and never charges a real card, and a pk_live_ key works on live data. Run the whole flow in test mode before you go live.

How do license keys work?

Switch on license keys for a product and every sale gets its own key, shown in the buyer's receipt, on the order and in the order.completed webhook. Your software checks it with three public endpoints (activate, validate, deactivate), so no API key ships inside your app.

Can my AI agent use the API?

Yes. The MCP server gives Claude, ChatGPT or your own agent 305 tools over the same API, with the same permissions you have. There is no API key to paste: you sign in and click Allow access.

What is a Merchant of Record?

A Merchant of Record (MoR) is the legal seller on each transaction. As your MoR, Pocketsflow handles payment processing, sales tax and VAT, fraud prevention, chargebacks and invoices, so you never set up a merchant account or register for tax abroad.

Ship the checkout today. Bill for usage tomorrow.

Free to start, no monthly fee. 2% a sale plus card processing, with tax, fraud and payouts handled.

Start selling free