Stripe Control Plane, Per-Project Checkout & Webhooks (Worker)
An AI-cofounder / autonomous-startup-builder SaaS
Overview
A Stripe control plane for an AI-cofounder / autonomous-startup-builder SaaS: a Cloudflare Worker that lets each autonomous company project create and validate Stripe checkout sessions and manage its own webhook forwarding, all scoped by a per-project JWT.
Why It Exists
The platform spins up many independent shops, each needing to take payments without managing its own Stripe integration. A shared control plane issues checkout sessions and routes webhooks per project, so payment plumbing is centralized while each project’s money flow stays cleanly isolated by token.
What We Built
A focused Worker (stripe-control-plane) exposing a small JSON API: POST /stripe/checkout-session (auto-routes the checkout), GET /stripe/checkout-session/:id (validate on the success page), and PUT/GET/DELETE /stripe/webhook-url (manage a shop’s forwarding URL). Requests authenticate with a Bearer JWT whose payload carries the projectId. The source is compact and well-separated: index.ts, stripe.ts, webhooks.ts, auth.ts, token.ts, db.ts and types.ts, with a schema.sql and an llms.txt API reference written for agent consumption.
Technologies & Approach
TypeScript on Cloudflare Workers with the official stripe SDK, deployed via Wrangler. JWT-scoped, multi-tenant design keeps every project’s checkout and webhook configuration isolated behind one deployable; shipping an llms.txt API description makes the endpoints directly discoverable by the agent fleet.
Outcome / Impact
Provides the payments primitive each generated company uses to sell, checkout creation, success validation and webhook routing, behind a single token-scoped, multi-tenant Worker.
Capabilities Demonstrated
- Multi-tenant Stripe control plane on the edge
- JWT/
projectId-scoped per-project checkout - Auto-routed checkout-session creation and validation
- Per-shop webhook URL management
- Agent-readable API surface (llms.txt)