Prerequisites
- A Pocketsflow account with at least one product.
- The ability to run a small server (any language) and expose it publicly for webhook testing.
1. Create API keys
In the dashboard, go to Developers → API keys and create a key. Keys are scoped to your account and come in two flavors:
Send the key as a Bearer token on every request:
2. Base URL and the interactive reference
- Base URL:
https://api.pocketsflow.com - Interactive reference (Scalar):
https://api.pocketsflow.com/docs - OpenAPI spec:
https://api.pocketsflow.com/docs.json
3. Test vs. live mode
Test mode gives you a full sandbox:- Everything you create with a
pk_test_…key (products, checkout sessions, orders) lives in test data, separate from live data. - Test-mode checkouts don’t move real money, and you receive test-mode webhooks so you can validate the whole flow.
- Switch to a
pk_live_…key only once the flow works end to end.
4. Make your first call
Create a checkout session and get a hosted URL to redirect a buyer to:{ "id": "cs_…", "url": "https://<yourstore>.pocketsflow.com/checkout?…" }.
Open url in a browser to complete a test purchase. See
Custom platforms for the full field list.
5. Receive webhooks locally
Webhooks are the source of truth for payment. To receive them on your machine, expose your local server with a tunnel:1
Run your handler locally
Start your webhook endpoint (for example on
http://localhost:3000/webhooks/pocketsflow).2
Open a public tunnel
Use a tunneling tool to get a public HTTPS URL that forwards to your local
port:
3
Register the tunnel URL as a webhook
In Developers → Webhooks (or via
POST /webhooks), point a webhook at
https://<your-tunnel>/webhooks/pocketsflow and subscribe to events like
order.completed. Save the signing secret shown once.4
Verify the signature
On each delivery, compute HMAC-SHA256 over the RAW body with your signing
secret and compare (timing-safe) to
X-Pocketsflow-Signature. See
Consuming webhooks.5
Send a test event
Use Developers → Webhooks → ⋯ → Send test to exercise your handler
without placing an order.
6. Build faster with an AI agent
Point an MCP-capable editor at the Pocketsflow MCP server to call the API as your account while you develop, and load these docs as context:- MCP setup guide — Claude Desktop, Cursor, ChatGPT copy-paste
- Claude Code + Pocketsflow
- Cursor + Pocketsflow
- Windsurf + Pocketsflow
Go-live checklist
- Flow works end to end with a
pk_test_…key. - Webhook signature verification passes on real deliveries.
- Handlers are idempotent and reconcile via
metadata. - Secrets are in environment variables, not in the repo.
- Swapped to a
pk_live_…key and a production webhook endpoint.