Skip to main content
You can connect Pocketsflow to almost any external store, platform, or internal tool using two building blocks:
  1. The HTTP API — to create checkout sessions and read/write data.
  2. Webhooks — to react when something happens (a sale completes, a subscription renews, a refund is issued).
This section shows how to combine them into a working integration, with a complete WooCommerce example and a generic pattern you can adapt to any platform.

The building blocks

API keys

Authenticate server-to-server with a pk_live_… / pk_test_… key.

Checkout sessions

POST /checkout/sessions returns a hosted URL to redirect buyers to.

Webhooks

Subscribe to events like order.completed and customer.created.

Metadata

Attach your own IDs so you can correlate Pocketsflow orders with yours.

The standard pattern

Almost every “sell through my own store / platform” integration follows the same five steps:
1

Create an API key

In the dashboard, go to Developers → API keys and create a key. Store it as a secret on your server.
2

Map your products to Pocketsflow products

Each item you sell maps to a Pocketsflow productId. Create products in the dashboard or via POST /products, and store the resulting productId alongside your own product records.
3

Create a checkout session at purchase time

When a buyer checks out, call POST /checkout/sessions with the productId, your successUrl / cancelUrl, and a metadata object containing your order id. Redirect the buyer to the url you get back.
4

Let the buyer pay on Pocketsflow

Pocketsflow hosts the checkout and handles payment, tax, and receipts. After payment the buyer is redirected to your successUrl.
5

Confirm the sale with a webhook

Register a webhook for order.completed. When it fires, verify the signature, read your order id back out of metadata, and mark the order paid in your system.

Why metadata matters

The metadata you pass when creating a checkout session is echoed back on the resulting order and in every related webhook payload. This is how you correlate a Pocketsflow order with the order in your own system — without it, you’d have no reliable way to know which of your orders a webhook refers to.
// Request: POST /checkout/sessions
{
  "productId": "65a1b2c3d4e5f6a7b8c9d0e1",
  "successUrl": "https://store.example.com/thank-you",
  "cancelUrl": "https://store.example.com/cart",
  "metadata": { "external_order_id": "WC-1043" }
}
// Later: the order.completed webhook payload echoes it back
{
  "order": { "id": "...", "amount": 4900, "currency": "usd" },
  "customer": { "email": "buyer@example.com" },
  "metadata": { "external_order_id": "WC-1043" }
}

Pick a guide

WooCommerce

A complete, step-by-step WooCommerce integration with PHP examples.

Any other platform

The generic redirect + webhook pattern, with Node and PHP examples.