Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+22 more

    Stripe Subscription Engine Skill

    1

    Scaffold and integrate secure Stripe subscription systems with seat-based billing and hardened webhook handlers.

    $23.99

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    Stripe Subscription Engine Skill

    Stripe Subscription Engine Skill

    Example session with this skill installed

    I need to add Stripe subscriptions to my Express/Prisma app. Users belong to Organizations, and I want to charge $20/month per seat. Scaffolding the schema and webhook handler first.

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

    I have analyzed your Express and Prisma setup. I will now scaffold the database schema and a hardened webhook listener to handle seat-based billing for your Organizations.

    Stripe Integration Plan

    ComponentActionDetails
    SchemaCreate MigrationAdds stripeCustomerId and subscription status to Organization table.
    WebhookPOST /api/webhooksImplements signature verification and invoice.paid logic.
    Entitlementsmiddleware/auth.tsCentralizes check for active or trialing status.
    MetadataMappingLinks organizationId to Stripe metadata for idempotent updates.
    // src/api/webhooks.ts
    import express from 'express';
    import Stripe from 'stripe';
    import { prisma } from '../lib/prisma';
    
    const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!, { apiVersion: '2023-10-16' });
    
    export const webhookHandler = async (req: express.Request, res: express.Response) => {
      const sig = req.headers['stripe-signature']!;
      let event: Stripe.Event;
    
      try {
        event = stripe.webhooks.constructEvent(req.body, sig, process.env.STRIPE_WEBHOOK_SECRET!);
      } catch (err) {
        return res.status(400).send(`Webhook Error: ${err.message}`);
      }
    
      if (event.type === 'customer.subscription.updated') {
        const subscription = event.data.object as Stripe.Subscription;
        await prisma.organization.update({
          where: { stripeCustomerId: subscription.customer as string },
          data: {
            subscriptionStatus: subscription.status,
            planId: subscription.items.data[0].price.id,
            seatCount: subscription.items.data[0].quantity,
          },
        });
      }
    
      res.json({ received: true });
    };
    

    Next steps

    1. Run npx prisma migrate dev to update your database schema.
    2. Add STRIPE_SECRET_KEY and STRIPE_WEBHOOK_SECRET to your .env file.
    3. Use the Stripe CLI to forward webhooks to your local server for testing.

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

    About this skill

    Hardcoding price IDs and trusting client-side payment redirects creates critical vulnerabilities in SaaS billing systems. Manual Stripe integrations often suffer from fragile webhook handlers, missing idempotency, and inaccurate local state synchronization.

    This skill scaffolds a production-grade Stripe subscription engine directly into your existing codebase. It detects your stack, designs a secure billing schema, and implements hardened webhook listeners to ensure your database stays in sync with Stripe's source of truth.

    What it does

    • Architects billing schema by designing migrations for users, customers, and subscription states.
    • Hardens webhooks using signature verification, raw body processing, and idempotency logic.
    • Secures checkout flows by creating sessions server-side with pre-configured Price IDs.
    • Maps entitlements to create a centralized policy for mapping Stripe statuses to application access.
    • Manages seat-based billing with server-side quantity validation and proration handling.

    How it works

    1. Discover and Plan: The agent inspects your repository to identify the framework, ORM, and auth patterns.
    2. Model Data: It generates migrations for Stripe customer mapping and subscription lifecycle tracking.
    3. Implement Logic: It builds the server-side endpoints for Checkout, the Customer Portal, and Webhooks.
    4. Test and Handoff: The agent runs integration tests for event processing and provides a dashboard setup checklist.

    Frameworks & tools

    Adapts to your detected environment including Node.js, Python, Ruby, Go, or PHP. Supports common ORMs like Prisma, Drizzle, or SQLAlchemy and interacts with the official Stripe SDK.

    Why this beats prompting it yourself

    Generic prompts often produce insecure code that trusts client-side data or fails to verify webhook signatures. This skill enforces strict architectural patterns for idempotency and entitlement logic that prevent revenue leakage and unauthorized access.

    Use cases

    • Adding a subscription layer to a new Next.js or Rails SaaS project.
    • Migrating from simple one-time payments to complex seat-based recurring plans.
    • Implementing a secure customer billing portal for self-service plan management.
    • Hardening an existing Stripe integration against duplicate webhook events and race conditions.

    Known limitations

    Does not perform destructive database resets without approval. Requires manual Stripe Dashboard configuration for products and prices. Secret management depends on your environment variables.

    How to use

    Skills on Agensi run inside your AI agent. Copy the prompt, paste it into your agent, and it connects to Agensi and installs this skill for you. If a payment is needed, your agent shows it to you first.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill passes our trust checks below.

    Security scanned

    Passed our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

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

    Trust & safety

    Security scanned

    Verified clean today

    • Passed all security checks, Safe to install

    Listedtoday

    What's inside

    Frequently Asked Questions