Payment Integration Lite — Stripe Checkout Quickstart

    by Beauty Script Lab

    1

    Secure Stripe Checkout integration with server-side session creation and verified webhook fulfillment.

    Free

    Security scanned

    Works with the AI Agents you already use

    Payment Integration Lite — Stripe Checkout Quickstart

    Example session with this skill installed

    I need to add Stripe Checkout to my Express app for a $19 one-time payment. Show me the session creation and the webhook handler for fulfillment.

    • Read your context and instructions
    • Compiled the payment integration lite

    I will implement a server-side Stripe Checkout flow. This includes a session creation endpoint with idempotency keys and a signature-verified webhook handler to process the checkout.session.completed event safely.

    Stripe Checkout Integration

    // 1. Create Checkout Session
    // Route to initiate payment
    app.post('/create-checkout-session', async (req, res) => {
      const { orderId, userId } = req.body;
      
      // map orderId to your server-side price catalog
      const PRICE_ID = 'price_12345'; 
    
      try {
        const session = await stripe.checkout.sessions.create({
          mode: 'payment',
          line_items: [{ price: PRICE_ID, quantity: 1 }],
          success_url: `${process.env.APP_URL}/success?session_id={CHECKOUT_SESSION_ID}`,
          cancel_url: `${process.env.APP_URL}/pricing`,
          client_reference_id: userId,
          metadata: { user_id: userId, order_id: orderId },
        }, { 
          idempotencyKey: `checkout-${orderId}` 
        });
    
        res.redirect(303, session.url);
      } catch (e) {
        res.status(500).json({ error: e.message });
      }
    });
    
    // 2. Verified Webhook Handler
    // Use express.raw() for this specific route to keep the body untouched
    app.post('/webhook', express.raw({ type: 'application/json' }), async (req, res) => {
      let event;
      const sig = req.headers['stripe-signature'];
    
      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 the fulfillment
      if (event.type === 'checkout.session.completed') {
        const session = event.data.object;
        
        // Check if we already processed this event ID in our DB
        const isNewEvent = await db.processedEvents.insertIfAbsent(event.id);
        if (isNewEvent) {
          await fulfillOrder(session);
        }
      }
    
      res.sendStatus(200);
    });
    
    async function fulfillOrder(session) {
      // Verify payment_status is 'paid' before delivering
      if (session.payment_status === 'paid') {
        await db.orders.update(session.metadata.order_id, { status: 'fulfilled' });
        // Trigger digital delivery logic here
      }
    }
    

    Next steps

    • Replace PRICE_ID with a real price ID from your Stripe Dashboard test mode.
    • Install the Stripe CLI and run stripe listen --forward-to localhost:4242/webhook to get your local whsec_ secret.
    • Test the flow using the 4242 test card to confirm your database updates correctly.

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

    About this skill

    Free quickstart version of the Payment Integration Skill: get a Stripe Checkout payment page live the safe way — server-side amounts, a verified webhook handler, exactly-once fulfillment, and the test cards to prove it works before you go live. The three safety rules that prevent the classic money bugs are included in full. General information, not legal or financial advice.

    Supports one-time payments only. No logic for subscriptions, trials, refunds, or disputes. Requires manual setup of Stripe SDK and environment variables.

    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

    Free to use

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 3 days ago

    • Free with an Agensi account

    Permissions

    Terminal / Shell
    Network Access
    Environment Variables
    Listed3 days ago

    What's inside

    Frequently Asked Questions

    This skill helps you implement a secure Stripe Checkout flow by providing the correct server side patterns for session creation and signature verified webhooks. It specifically solves the security risks of client side fulfillment and the technical challenges of handling duplicate webhooks or race conditions.

    To use this skill, you need a Stripe account to access your API keys and the Stripe CLI if you want to test webhooks locally. The implementation patterns provided focus on Node.js and Express environments using the Stripe SDK.

    This lite edition is designed exclusively for one time payments. It does not include logic for recurring subscriptions, trial periods, refunds, customer portals, or handling payment disputes.

    The skill provides implementation patterns for a server side endpoint to generate secure checkout redirects and a dedicated webhook route for order fulfillment. It also includes specific test card data and CLI commands to simulate and verify successful payments.

    You can ask your agent to architect a hosted checkout session or to write a webhook handler that uses raw request bodies for signature verification. You can also request a walkthrough of how to map your internal product IDs to Stripe prices to ensure all amounts are determined server side.

    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.

    Free