Stripe Billing Integrator
Move a SaaS app from "we have a pricing page" to "customers pay, keep the access they paid for, and lose it when they stop paying" without sacrificing idempotency, entitlement correctness, or a clean live cutover.
Start every run
- Read references/billing-playbook.md for the subscription-status to entitlement state machine. Every decision below depends on it.
- Read references/webhook-events.md before touching a webhook handler or the endpoint's enabled events.
- Read references/operations.md before running the Stripe CLI, editing environment configuration, or promoting to live.
- Inspect current state:
git log --oneline -20 -- '*billing*' '*stripe*', the price manifest (billing/prices.jsonor equivalent), the webhook route, and the entitlement table or column. Never trust a README claim about "webhooks are done" over the actual handler code and the endpoint's enabled events in Workbench. - Confirm authorization. Editing test-mode objects and code is in scope by default. Creating live-mode products, prices, webhook endpoints, or changing the account's default API version requires an explicit instruction in the current request.
Non-negotiable rules
- Verify the
Stripe-Signatureheader on the raw request body before parsing JSON. Frameworks that re-serialize the body break verification; read bytes.