Delivery format
Every delivery is an HTTPPOST with a JSON body and these headers:
Every payload starts with three envelope fields —
id (the event id), type
(the event type) and created (unix seconds) — followed by the event fields
shown below, and ends with a webhookId field identifying the endpoint the
event was delivered to. Test deliveries (POST /webhooks/{id}/test) also carry
"test": true. The examples below show the event fields; the envelope is
omitted for brevity. A trimmed order.completed body looks like:
Each attempt has a 15-second timeout.
5xx, 429, timeouts, resets and
connections that never reached your endpoint are retried up to 4 attempts in
total (about 10s, 1 min, then 5 min apart), always with the same event id.
Acknowledge with a 2xx immediately, do the real work asynchronously, and
reconcile periodically via the API (for example
GET /payments) in case a delivery is
missed. Every attempt — success or failure — is recorded in your account’s
webhook delivery log.Test vs live deliveries
A webhook endpoint is created in whichever mode your account is currently in. A test-mode endpoint only receives events generated by test-mode sales (pk_test_…); a live-mode endpoint only receives live events. Register the
endpoint in the same mode as the traffic you want to observe.
Event catalog
You can subscribe to any of the following when you create or update a webhook.Three additional events —
identity.verification_session.verified, identity.verification_session.processing,
and identity.verification_session.requires_input — exist in the subscribable
event list for creator KYC / identity verification, but they are reserved for
internal use and are not currently delivered to webhook endpoints. Do not
build on them.Order events
order.completed
Fires when a one-time product payment succeeds (all completed sales).
Delivered alongside customer.created.
order.id is the Pocketsflow order/sale id; paymentIntentId is the
underlying processor payment id (pay_…). variantId and
vatNumber are null when not applicable. metadata echoes back any
webhookMetadata you attached at checkout, and a top-level
clientReferenceId echoes the clientReferenceId/externalId you supplied
(or null). Free orders (a
100% discount or a free product) deliver a slightly different shape: amount
is 0, order carries no paymentIntentId/planId, and the tax block
uses amount/rate keys instead of taxAmount/taxRate — don’t assume
every field above is always present.activationLimit is null for unlimited. Products without license keys send
no licenseKey field. On a gift order the key belongs to the recipient: it is
emailed to them, not to the buyer.
Launch pricing
Orders priced by an early-bird step, a flash sale, fair pricing or a code carry apricing object: how the price
was reached, in your currency (main product, before tax). source is the one
discount applied (flash_sale, fair_pricing, code) or null.
pricing.fairPricing carries the country, the percent and
verified: false when the billing country collected at payment was another
country.
Gift orders
When the buyer ticked This is a gift at checkout,order.completed also
carries a gift object. customer is still the person who paid; the
product belongs to gift.recipientEmail. If you deliver access yourself
(licence keys, an external course, a community invite), send it to the
recipient, not to customer.email. Normal orders have no gift key.
status is delivered once we emailed the recipient (or sending /
failed while that is still pending). The same object is returned as gift
on orders from the API. A refund or dispute revokes the recipient’s access the
same way it revokes a buyer’s.
order.refunded
Fires when a charge is refunded (fully or partially). It replays the same
metadata (and top-level clientReferenceId) the original order.completed
carried, so you can match the refund to your own record.
order.post_purchase_accepted
Fires when a buyer accepts your post-purchase offer
and the one-click charge settles. The new order is a normal order: it also
fires order.completed (its own order.id). This event links the two:
parentOrder.id is the order the offer followed.
amount is in major units of currency (9.6 = $9.60).
Customer & review events
customer.created
Fires on every completed sale (delivered next to order.completed) and whenever
you create a customer via the API. On a sale, the payload identifies the new
customer plus the related product and order:
POST /customers, the payload is the full customer
record (_id, userId, buyerEmail, country, productId, testMode, …)
plus webhookId.
review.created
Fires when a buyer submits a product review. The payload is the full review
record:
Product events
product.created, product.updated, and product.deleted fire from the
product endpoints. Each payload is the full product document plus webhookId:
Subscription events
Pocketsflow distinguishes the initial subscription payment from renewals:- The first charge that activates a membership fans out
payment_intent.succeeded. - Every charge — the first one and every renewal — fans out
invoice.createdwhen it is opened, theninvoice.payment_succeededorinvoice.payment_failedwhen it settles.billingReason(initialorrenewal) tells the two apart.
GET /payments?type=subscription (with
billingReason of initial or renewal).
customer.subscription.created fires only on activation — exactly once,
and it is never paired with customer.subscription.updated. (It used to
deliver both back-to-back, which made .updated useless as a “something
changed” signal.) .updated now fires only on a state change after
activation: past_due, recovery, cancel-scheduled, pause, resume, and
cancellation. If you were keying “new subscriber” off .updated, switch to
.created.paymentMethod — the card paying for
the subscription — in the same shape order.completed sends:
id is the stable per-card identifier — key on it to recognise the same card
across charges. Non-card payment methods send "paymentMethod": null. The two
events with no charge in play — customer.subscription.deleted and
customer.subscription.trial_will_end — omit the card.
Correlation fields. Every subscription event additionally carries three
top-level fields for binding events to your own records:
subscriptionCustomerId— the stable id of this one subscription (the same value assubscription.customerId), present on every event for that subscriber includingcustomer.subscription.deleted. It identifies a subscription, not a person — one buyer with two subscriptions has two different ids. See Field reference below. Oninvoice.*events fired before the subscriber record exists (the very first charge) it isnull.clientReferenceId— echoes back theclientReferenceId(orexternalId) you supplied at checkout,nullwhen you didn’t.metadata— replays the checkout metadata you attached (via checkout-URL query params, the popup’smetadataoption, or a checkout session’smetadata), captured at activation. Subscriptions created before this field existed replay{}.
"metadata": {} for brevity — with checkout
metadata attached you get your own key/values back, e.g.
"metadata": { "watch_id": "w_123" }.Field reference
Most subscription events share the same core blocks. Here’s exactly what each field means so you know what to store and what to key on:The subscription offer id — the recurring product the buyer signed up to.
This is shared by every buyer on that offer; it is not unique to one
subscriber.
The subscriber id — one specific buyer’s single subscription to the offer
above (the id of the underlying SubscriptionCustomer record). Same value as the
top-level
subscriptionCustomerId. null only on the very first invoice.*
charge, before the subscriber record has been created.The top-level, flattened copy of
subscription.customerId — provided so you
don’t have to reach into the nested subscription block. Present on every
event for that subscriber, including customer.subscription.deleted.The subscriber’s current state —
{ id, status, active, cancelAtPeriodEnd, paused }. Sent on customer.subscription.created / .updated only. Read this
to see what the subscription now looks like rather than inferring it from the
event name.The buyer —
{ email, firstName, lastName }. customer.email is the stable
identity of the person; use it to recognise the same buyer across
different subscriptions (see the warning below).On
invoice.* events only: initial for the first charge that activates the
membership, renewal for every recurring charge after it, usage for a
usage-based overage charged at the end of a billing period.The card paying for the subscription —
{ id, type, brand, last4, expMonth, expYear } — or null when no card is on file or the method isn’t a card.
id (payt_…) is the stable per-card identifier; key on it to recognise the
same card across charges.Echoes back the
clientReferenceId / externalId you supplied at checkout, or
null when you didn’t.Your checkout metadata, replayed verbatim (e.g.
{ "watch_id": "w_123" }).
{} when none was attached.On
customer.subscription.created / .updated: the buyer’s self-service
billing portal link — safe to email them.Identifies the endpoint this event was delivered to. Included in the signed
body — verify the signature before parsing.
payment_intent.succeeded (initial subscription payment)
subscription.id is the subscription offer id; subscription.customerId is
the subscriber (SubscriptionCustomer) id.
invoice.created
Fires when a subscription charge is opened, before it settles — the terminal
outcome follows as invoice.payment_succeeded or invoice.payment_failed. On
the very first charge the subscriber record does not exist yet, so
subscription.customerId is null.
invoice.upcoming
A heads-up 3 days before the renewal charge, so you can warn the buyer (or
nudge them to fix an expiring card) before the card is hit. Only subscriptions
that will actually be charged produce it — cancelled, cancel-at-period-end, and
paused subscriptions do not.
invoice.payment_succeeded (first charge and renewals)
Fires on the first charge, every renewal and every paid usage overage
(billingReason: "usage", once per overage order) — billingReason
disambiguates.
On the first charge subscription.customerId can be null.
trial is true on a paid trial’s first charge (the trial price, paid at
checkout); the regular price follows as billingReason: "renewal" when the
trial ends. It is false on every other charge.
billingReason and the null customerId:
invoice.payment_failed
Fires when a subscription charge fails; the subscriber’s status becomes
past_due. Use it to trigger dunning emails or pause access.
payment_intent.payment_failed and
customer.subscription.updated are delivered
alongside it.
payment_intent.payment_failed
Delivered alongside invoice.payment_failed on every failed charge. Same
information, plus the card that was declined. Subscribe to whichever of the two
suits your integration — subscribing to both means two deliveries per failure.
customer.subscription.deleted (cancellation)
Fires when a membership is deactivated/cancelled. The subscriber’s status
becomes canceled and active becomes false. Revoke access here.
customer.subscription.created
Fires once, when the subscription activates — never paired with
customer.subscription.updated. This is the “new subscriber” signal: grant
access here.
subscriptionCustomer is the current state of the subscriber: status,
whether they’re active, whether a cancel is scheduled
(cancelAtPeriodEnd), and whether payment collection is paused. portalUrl
is the buyer’s self-service billing portal — safe to email them.customer.subscription.updated
Same shape as created. Fires on a state change after activation:
past_due, recovery, cancel-scheduled, pause, resume, and cancellation. It
never fires on creation. Read subscriptionCustomer / status to see what the
subscription now looks like, rather than inferring it from the event name.
failureMessage instead of
cancelAtPeriodEnd:
customer.subscription.pause
Fires when payment collection is stopped. The buyer keeps access — only the
charging stops, until the subscription is resumed. That’s why accessRetained
is true and the subscriber stays active. Do not revoke access on this
event; revoke on customer.subscription.deleted.
customer.subscription.resumed
Fires when a pause is lifted (collection restarts) or a scheduled cancel is
reversed — either way, the subscription will keep billing.
customer.subscription.trial_will_end
Fires when a trial is about to end and the first real charge is coming.
Subscription retention events
Delivered when subscription retention is on (Pro plan). They carry the samesubscription, customer,
subscriptionCustomerId, clientReferenceId and metadata blocks as the
other subscription events.
subscription.payment_failed
Fires when a renewal fails and failed payment recovery starts, and again on
each later failed attempt of the same renewal. recovery.nextRetryAt is when
the next scheduled attempt (day 1, 3, 5 or 7 after the first failure) runs.
subscription.recovered
Fires once when a failed renewal is paid — by the subscriber after updating
their card, or on a retry.
subscription.saved
Fires when a subscriber who started to cancel in the subscriber portal accepts
a save offer instead. offer is pause (with pauseMonths and resumeAt)
or discount (with discountPercent for the next discountMonths
payments). A pause also fires customer.subscription.pause.
subscription.upgraded
Fires when a subscriber you upgraded with POST /subscriptions/{id}/upgrade
is active on the new subscription. The old subscription ended at the same
moment (it also fires customer.subscription.deleted) and the new one fires
customer.subscription.created, with the old subscription’s metadata
carried over. chargedAmount is the new price minus credit for the unused
part of the old period; the new subscription renews at newPrice every
billingPeriodDays from today.
subscription.upgrade_failed
Fires when an upgrade’s charge, still clearing when the API answered 202,
is declined. Nothing changed: the subscriber stays on their current
subscription.
Verifying the signature
VerifyX-Pocketsflow-Signature-V2 (timestamp-bound, with a 5-minute
tolerance) as described in
Authentication & security,
and deduplicate on X-Pocketsflow-Event-Id.
The legacy X-Pocketsflow-Signature is still sent: it is
HMAC-SHA256(secret, rawBody), hex-encoded, where rawBody is the exact JSON
body Pocketsflow sent (it already includes webhookId). Never re-serialize the
parsed object before verifying — hash the raw bytes.
X-Pocketsflow-Signature header using a constant-time
comparison, and reject the request if they don’t match.
Credit events
Additive events for prepaid Credits products and subscriptions. Existingproduct.* and order.* payloads keep their shapes. Subscribe to these if you
fulfill usage from your own app.
Old clients that do not subscribe to credit events are unchanged.
Shared credit payload
balanceCents and topOffCents are integer cents (always two decimal places
on the charge). productId is the catalog item — a one-time product or a
subscription offer.
Usage billing events
Sent for subscriptions with usage-based or per-seat pricing. Amounts are integer cents in your account currency.usage.recorded
Fires once per new usage report (POST /subscriptions/{id}/usage). A retried
report with the same idempotencyKey does not fire it again.
usage.period_closed
Fires once when a subscriber’s billing period ends, after the overage charge
was attempted. charge.status is not_due (nothing above the included
units), processing (sent to the card, settling), paid, failed (declined)
or due (recorded but not charged — reason says why, e.g.
no_saved_payment_method). Failed and due charges are retried 1, 3, 5 and 7
days after the first failure, then marked uncollectible. A paid overage is
also recorded as an order and delivered as
invoice.payment_succeeded
with billingReason: "usage" — the same event a renewal sends — once per
overage.
customer.subscription.updated with change: "seats",
previousQuantity and the new subscriptionCustomer.quantity.
Payment plan events
See Payment plans. Every payment of a plan is its own order withinstallment: { index, of }; payment 1 also fires
order.completed.
installment.paid
Fires once per successful payment of a plan, the first one included.
installment.failed
Fires when a later payment of a plan fails (a failed first payment is a
declined checkout, not a plan). The card is retried automatically and the
buyer keeps access. payment_intent.payment_failed fires with the same body.
A/B test events
ab_test.completed
Fires once when an A/B test ends (Pro plan): endReason is winner (the
winning version was applied to the product — product.updated fires too),
stopped (ended without a winner), product_edited (the tested field of
the product was edited, endDetail names it) or product_deleted. Carries
every version’s results; revenue is in your account currency. For a
subscription test, itemKind is subscription and productId is the
subscription’s id.
Affiliate tier events
See Affiliate tiers. Fires only for your program’s tiers (an affiliate with their own tiers doesn’t fire it).affiliate.tier_changed
Fires when a recorded sale moves an affiliate into a higher tier: their NEXT
sale earns tier.rate. periodSales counts this sale. A refund or a new
period that lowers the count doesn’t fire it.
Loyalty events
See Loyalty points and store credit.loyalty.credit_redeemed
Fires once per order paid partly with store credit, after the payment
landed. credit.amount is in your currency; balance is what the buyer has
left. The order itself arrives as order.completed.
Revenue split events
See Revenue splits. Amounts are integer cents ofcurrency (the seller’s settlement currency). role says whether the
receiving account is the product owner or a collaborator.
split.created
Fires once per split sale, right after the sale is recorded (an order bump or
a payment-plan payment of a split product included). The owner’s copy carries
every share and ownerCents; a co-creator’s copy only their own share, with
ownerCents: null.
split.paid
Fires when a co-creator’s pending shares were transferred to their payouts
account. amountCents is what moved: grossCents (the shares) minus
clawbackCents (shares refunded after an earlier payout).
Course events
Growth plan and above (drip content, quizzes and certificates).course.completed
Fires once per order, when the buyer has completed every lesson and passed
every quiz marked “must pass”.
certificate.issued
Fires once per order, when the buyer claims their certificate.
Payout events
Payouts are read only in the API: withdrawing happens in the dashboard. These events tell your systems (or your AI) when money moves.data.payout has the
same shape as GET /payouts/{id}.
payout.created
Fires when a withdrawal of your balance is requested.
payout.updated
Fires each time a payout changes status: awaiting_payment, in_transit,
completed, failed, canceled or denied. The same status is never sent
twice. A denied payout was refused by compliance review: call
GET /payouts/status to see what is
needed.