Documentation Index
Fetch the complete documentation index at: https://docs.pickupbell.com/llms.txt
Use this file to discover all available pages before exploring further.
POST /api/billing/webhook
Verification
Every request is signature-verified using the payments provider’s standard mechanism and theBILLING_WEBHOOK_SECRET env var. Requests without a matching signature get 400 Bad Request and are not processed. This is the only PickupBell inbound webhook that enforces signature verification — it writes to billing state.
Events handled
| Event type | Action |
|---|---|
customer.subscription.created | Upsert the subscription row. |
customer.subscription.updated | Reconcile; status flips to active / past_due / canceled as reported. |
customer.subscription.deleted | Status → canceled. |
checkout.session.completed | Retrieve the subscription, run the same reconciliation. |
invoice.paid | Fetch subscription, reconcile (in case current_period_end moved). |
invoice.payment_failed | Fetch subscription, reconcile (status → past_due). |
Idempotency
Every processed event id lands in thestripe_events table (id PRIMARY KEY, type, location_id, processed_at, raw). On retry the handler looks up the id first and returns { "received": true, "duplicate": true } without re-processing.