Payment Integration Skill — Stripe, Webhooks, Subs

    by Beauty Script Lab

    1

    Secure Stripe integration for Checkout and Subscriptions with verified webhooks and dunning management.

    $39

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI Agents you already use

    Payment Integration Skill — Stripe, Webhooks, Subs

    Example session with this skill installed

    I need to add a subscription checkout to my Node/Express app. Ensure it handles the webhook fulfillment for a 'pro' plan and uses a trial.

    • Read your context and instructions
    • Compiled the payment integration

    I have generated the Stripe integration logic for your Node.js application. This setup uses

    Hosted Checkout to minimize PCI scope and includes a signature-verified webhook handler for secure fulfillment.

    Stripe Subscription Integration

    // 1. Server-side Checkout Session Creation
    const stripe = require('stripe')(process.env.STRIPE_SECRET_KEY);
    
    app.post('/create-checkout-session', async (req, res) => {
      const { userId } = req.body; // Use authenticated user ID
      
      const session = await stripe.checkout.sessions.create({
        mode: 'subscription',
        payment_method_collection: 'always',
        line_items: [{
          price: process.env.PRO_PLAN_PRICE_ID,
          quantity: 1,
        }],
        subscription_data: {
          trial_period_days: 14,
          metadata: { user_id: userId }
        },
        success_url: `${process.env.APP_URL}/success?session_id={CHECKOUT_SESSION_ID}`,
        cancel_url: `${process.env.APP_URL}/pricing`,
        client_reference_id: userId,
      }, {
        idempotencyKey: `sub_create_${userId}`,
      });
    
      res.redirect(303, session.url);
    });
    
    // 2. Verified Webhook Handler
    app.post('/webhook', express.raw({type: 'application/json'}), async (req, res) => {
      const sig = req.headers['stripe-signature'];
      let 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}`);
      }
    
      // Handle fulfillment
      if (event.type === 'checkout.session.completed') {
        const session = event.data.object;
        await fulfillOrder(session); // Implement exactly-once logic here
      }
    
      res.json({ received: true });
    });
    

    Next steps

    • Set PRO_PLAN_PRICE_ID and STRIPE_WEBHOOK_SECRET in your .env file.
    • Start the Stripe CLI using stripe listen --forward-to localhost:3000/webhook to get your local signing secret.
    • Implement the fulfillOrder function with a database check to prevent duplicate provisioning.

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

    About this skill

    Install it and your AI wires your product to a working payment channel: checkout, verified webhooks, subscriptions with trials and failed-payment recovery, and a 10-point go-live gate — then hands you back a channel that actually takes money. Built around the failure modes that cost real money: forged webhooks, duplicate fulfillment, async payments marked paid too early, prices tampered on the client. Cold-tested on three scenarios including an adversarial one — forged webhook, out-of-order events, tampered amount — all handled correctly. Includes the rails appendix Stripe will never write: merchant-of-record platforms, USDC payouts and per-call payments for sellers who can't open Stripe directly. Deep-processed from an open-source skeleton (MIT); the decision tree, debugging tables, checklist and appendix were rebuilt by Beauty Script Lab. General information, not legal or financial advice.

    No support for Stripe Connect or marketplace payouts. Does not provide raw-card PCI-DSS Level 1 designs. Restricted to Web-based integration patterns.

    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 buying a skill.

    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

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

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

    Trust & safety

    Security scan

    Security scan passed 3 days ago

    Permissions

    Read Files
    Network Access
    Environment Variables
    Listed3 days ago

    What's inside

    Frequently Asked Questions

    This skill enforces a security first approach by requiring signature-verified webhooks for all order fulfillments. It prevents common production failures like price tampering, spoofed success redirects, and double-charging through mandatory idempotency keys and state mirroring.

    You will need a Stripe account and access to the Stripe SDK and Stripe CLI for event forwarding and testing. The skill is designed for server-side environments using Node.js and Express.

    The skill provides a decision tree to choose your integration mode, server-side session creation code, a canonical webhook handler for event deduplication, and a subscription status mapping table. It also includes a hard go-live checklist to ensure your production environment is correctly configured.

    This skill focuses on web integrations and does not support Stripe Connect for marketplace payouts. It also excludes custom raw-card designs to maintain a smaller PCI scope and does not cover mobile app specific implementations.

    You can ask your agent to help you add recurring billing to a SaaS app, debug signature verification errors in your webhook handler, or walk you through the test-mode discipline using a test clock for subscription time travel.

    It teaches you to treat Stripe as the source of truth and update your database only via verified webhooks. It maps complex subscription states like past_due and incomplete to specific app access logic so your user permissions never drift out of sync.

    New in APIs & Backend

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for APIs & Backend.