Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    Stripe Subscription Engine

    2

    Add Stripe subscriptions to your app: Checkout, customer portal, secure webhooks, plans, seats, proration and failed-payment dunning, wired to your database.

    $24

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    7 usesSecurity scanned
    Stripe Subscription Engine

    Stripe Subscription Engine

    Example session with this skill installed

    Set up subscription billing for my Next.js SaaS. I have three plans (Starter, Pro, Team) with Team being per-seat. Use Stripe and our existing Postgres + Prisma setup. I need upgrades to prorate and failed payments to retry before cancelling.

    • Read your context and instructions
    • Compiled the stripe subscription engine

    I've scaffolded the full billing layer

    • Prisma models: Customer, Subscription, Price, and a WebhookEvent log for idempotency.
    • /api/checkout route that creates a Checkout Session for Starter/Pro/Team (Team collects seat quantity).
    • /api/webhooks/stripe with signature verification and an exactly-once handler for created/updated/deleted, invoice.paid, and invoice.payment_failed.
    • Customer Portal session route for self-serve upgrades, downgrades (prorated), and cancellations.
    • Dunning: 3 smart retries over 7 days with email hooks, then a grace period before downgrade.
      Next step: add your Stripe price IDs to .env (placeholders generated) and run the included webhook test script against the Stripe CLI.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Billing is the part of your SaaS that has to be perfect — and it is the part most likely to be quietly broken. Stripe Subscription Engine turns your AI agent into a senior payments engineer that scaffolds a complete, production-grade subscription system end to end: Checkout, the customer portal, idempotent webhooks, plan and seat management, proration, and dunning — all wired to your database with the edge cases already handled.

    The Problem

    Every SaaS needs subscription billing, and almost every hand-rolled implementation is subtly wrong. The happy path (a customer subscribes) is easy. The money-losing parts are everything else: a webhook that fires twice and double-charges, a checkout.session.completed you trusted before the invoice was paid, a downgrade that forgets to prorate, a failed renewal that never triggers a dunning email so the customer silently churns, a subscription whose state drifts out of sync with your database after a Stripe-side change. These bugs do not crash — they leak revenue and erode trust, and you usually find them in a support ticket.

    What It Does

    Stripe Subscription Engine scaffolds the entire billing layer with production hardening built in:

    1. Checkout & Portal — Generates the Checkout Session flow for new subscriptions and wires up the Stripe Customer Portal so users can upgrade, downgrade, update cards, and cancel without you building any UI.
    2. Hardened Webhooks — Builds a signature-verified, idempotent webhook handler that processes every subscription lifecycle event exactly once, with replay safety and an event log.
    3. Plans, Seats & Proration — Implements tiered plans, per-seat billing, mid-cycle upgrades/downgrades, and correct proration so customers are always charged the right amount.
    4. Dunning & Recovery — Handles failed payments with retry logic, customer notifications, and a grace period so a declined card does not become silent churn.
    5. Source-of-Truth Sync — Generates the database schema and reconciliation logic that keeps your local subscription state perfectly in sync with Stripe, even after out-of-band changes.

    Why Use This Skill

    Billing is the highest-stakes, lowest-tolerance code in your product: a bug here charges real customers real money. This skill encodes the patterns payments teams learn the hard way — idempotency keys, webhook-driven state, never trusting the client, reconciliation over assumption — into a complete scaffold your agent generates in minutes instead of the week it takes to get right by hand. It pays for itself the first time it prevents a single double-charge or a month of silent churn.

    Supported Stacks

    Frameworks: Next.js (App Router, default), Remix, SvelteKit, Express, NestJS, and most Node/TypeScript backends. Database/ORM: Postgres with Prisma (default), Drizzle, or raw SQL; adaptable to MySQL. Payments: Stripe Billing (Checkout, Customer Portal, Webhooks, the Subscriptions API).

    Use Cases

    Launch billing for a new SaaS in a day instead of a week, with the edge cases already covered. Replace a fragile hand-rolled Stripe integration with a hardened, idempotent one. Add per-seat or tiered plans and correct proration to an existing product. Stop revenue leakage from failed-payment churn with built-in dunning.

    Known Limitations

    You bring your own Stripe account and set your product/price IDs; the skill generates the integration and placeholders, not your Stripe catalog. Tax (Stripe Tax) and complex usage-based metered billing are scaffolded as optional extension points rather than fully configured, since they depend on your jurisdiction and metering model. The skill never handles live card data directly — all card entry happens in Stripe-hosted Checkout and Portal, by design.

    You bring your own Stripe account and set your product/price IDs; the skill generates the integration and placeholders, not your Stripe catalog. Tax (Stripe Tax) and complex usage-based metered billing are scaffolded as optional extension points rather than fully configured, since they depend on your jurisdiction and metering model. The skill never handles live card data directly - all card entry happens in Stripe-hosted Checkout and Portal, by design.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before any payment.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    7 uses

    Times used to date

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 5 months ago

    Permissions

    Read Files
    Write Files

    File Scopes

    lib/**
    prisma/**
    src/**
    app/**

    Reads your project files and writes the generated billing integration (API routes, webhook handler, database schema, and config). Uses the terminal to install dependencies and run the included webhook test script. It never handles live card data - all card entry stays in Stripe-hosted Checkout and Portal - and does not require your Stripe secret key to scaffold the code (you add keys to .env yourself).

    Listed5 months ago
    Updated24 days ago

    What's inside

    Frequently Asked Questions

    The skill scaffolds a production-ready billing architecture, including hardened idempotent webhooks, checkout flows, and database sync logic, specifically designed to handle edge cases like double-charges, proration, and failed payment recovery that are often missed in manual setups.

    It is optimized for use with coding agents like Cursor, Windsurf, and GitHub Copilot, but it can also be used by any developer who needs a structured, expert-level scaffolding for a TypeScript-based backend.

    You receive the full integration logic for Checkout and the Customer Portal, a signature-verified webhook handler, database schema templates for subscription state, and the core logic for seat-based billing and proration.

    Yes; while it defaults to Next.js and Prisma, the generated code is modular and can be adapted to any Node.js environment, including Express, Remix, and SvelteKit, using your preferred ORM or database driver.

    The skill implements a source-of-truth reconciliation pattern that automatically updates your local database status whenever a subscription changes on Stripe’s end, preventing 'state drift' where your app thinks a user is active but their payment actually failed.

    The engine provides the infrastructure to handle metered billing events, but because your specific metering logic (e.g., per-GB or per-compute-hour) is unique to your product, you will need to map your specific usage events to the provided extension points.

    New in APIs & Backend