setup-billing
Skill1 starsChanged 5 months agoMITView on GitHub
Implement Stripe billing end-to-end: products/prices from config, checkout session, webhook handler with signature verification and idempotency, and customer portal. Present plan then implement.
- Reads credentials
In this repository22 other files it gives its agents.
- build-featureSkill
- code-reviewSkill
- compliance-checkSkill
- design-architectureSkill
- design-pricingSkill
- design-schemaSkill
- design-uiSkill
- helpSkill
- launch-checklistSkill
- map-flowsSkill
- qa-planSkill
- scope-checkSkill
- security-auditSkill
- setup-deploySkill
- setup-stackSkill
- startSkill
- studio-statusSkill
- test-setupSkill
- threat-modelSkill
- validate-ideaSkill
- write-prdSkill
- write-testsSkill
The file
Files
Wire up the full Stripe billing integration based on the approved pricing spec: create Stripe products and prices programmatically from a config file, implement the checkout and portal flows, and build a webhook handler that is safe to deploy to production. Non-autonomous: implementation plan is presented and approved before any code is written.
Phases
- Load pricing spec — read
docs/specs/pricing.md. If it is missing or incomplete, stop and direct to/design-pricing. Confirm the Stripe account mode (test vs. live) and thatSTRIPE_SECRET_KEYandSTRIPE_WEBHOOK_SECRETare present in.env.example. - Present implementation plan — show the files that will be created:
lib/stripe/config.ts(plan definitions),lib/stripe/client.ts(server-side Stripe instance),app/api/stripe/checkout/route.ts(checkout session endpoint),app/api/stripe/portal/route.ts(customer portal endpoint),app/api/stripe/webhook/route.ts(webhook handler), and any UI components for pricing and upgrade buttons. Get approval before writing. - Implement config and client — write
lib/stripe/config.tswith plan definitions loaded from environment variables or a static config object (no hardcoded price IDs in business logic). Writelib/stripe/client.tsexporting a server-only Stripe instance. Show files before writing. - Implement checkout and portal — write the checkout session route handler (creating or retrieving the Stripe Customer, setting
success_urlandcancel_url, attaching metadata for tenant/user ID) and the customer portal handler. Both must validate that the requesting user is authenticated via Supabase Auth. - Implement webhook handler — write
app/api/stripe/webhook/route.tsthat: (a) reads the raw request body usingrequest.text(), (b) callsstripe.webhooks.constructEventwithSTRIPE_WEBHOOK_SECRET, (c) handlescheckout.session.completed,customer.subscription.updated, andcustomer.subscription.deletedevents, (d) uses anupsertor idempotency key pattern in Supabase to prevent duplicate processing, and (e) returns 200 immediately — any heavy processing is deferred. - Verify and review — run
tsc --noEmitto confirm no TypeScript errors. Invoke/code-reviewon the billing files. Updatedocs/specs/pricing.mdwith any implementation notes. Next step: point to/setup-deploy. Honor the review intensity: underfull, walk through each implementation file for sign-off; underlean, get a single confirmation before writing; undersolo, proceed and summarize after.
Output
Billing code across lib/stripe/ and app/api/stripe/. Updates docs/specs/pricing.md with implementation notes. Writes nothing without approval.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

