Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
jezweb avatar

Stripe Payments

  • 913 installs
  • 946 repo stars
  • Updated July 2, 2026
  • jezweb/claude-skills

stripe-payments is a Claude Code agent skill that adds working Stripe Checkout Sessions, subscriptions, webhooks, and customer portal flows to web apps for developers accepting payments without an MCP server.

About

stripe-payments is a jezweb Claude Code skill for adding Stripe payments to web applications using the Stripe npm package directly without an MCP server. It covers Checkout Sessions, Payment Intents, subscriptions, webhook verification, customer portal, and pricing page patterns while helping choose the right Stripe API for each use case. The skill is marked claude-code-only and allows Read, Write, Edit, Bash, Glob, and Grep tools to produce working integration code. Developers reach for stripe-payments when triggers include add payments, checkout, subscription, stripe webhook, or customer portal on a SaaS or ecommerce site.

  • Decides which Stripe API to use with a decision table covering one-time payments, Payment Intents, subscriptions, Setup
  • Generates complete working integration code using the official Stripe npm package
  • Implements secure webhook verification and event handling
  • Creates pricing pages and customer billing management flows
  • Default recommendation is Checkout Sessions for fastest time-to-money

Stripe Payments by the numbers

  • 913 all-time installs (skills.sh)
  • +28 installs in the week ending Jul 29, 2026 (Skillselion tracking)
  • Ranked #422 of 4,353 Backend & APIs skills by installs in the Skillselion catalog
  • Security screen: MEDIUM risk (skills.sh audit)
  • Data as of Jul 31, 2026 (Skillselion catalog sync)
npx skills add https://github.com/jezweb/claude-skills --skill stripe-payments

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs913
repo stars946
Security audit2 / 3 scanners passed
Last updatedJuly 2, 2026
Repositoryjezweb/claude-skills

How do you add Stripe checkout to a web app?

Add fully working Stripe payments including Checkout Sessions, subscriptions, webhooks, and a customer portal to their web app.

Who is it for?

Claude Code users shipping SaaS or ecommerce web apps who need end-to-end Stripe billing without a separate MCP layer.

Skip if: Mobile-native in-app purchase flows or teams requiring PCI-heavy custom card forms instead of Stripe-hosted Checkout.

When should I use this skill?

A web app task mentions Stripe, checkout, subscriptions, billing, payment forms, webhooks, or customer portal integration.

What you get

Working Stripe Checkout or subscription flow, verified webhook handler, customer portal link, and pricing page integration code.

  • checkout integration
  • webhook handler
  • customer portal setup

Files

SKILL.mdMarkdownGitHub ↗

Stripe Payments

Add Stripe payments to a web app. Covers the common patterns — one-time payments, subscriptions, webhooks, customer portal — with working code. No MCP server needed.

Which Stripe API Do I Need?

You want to...UseComplexity
Accept a one-time paymentCheckout SessionsLow — Stripe hosts the payment page
Embed a payment form in your UIPayment Element + Payment IntentsMedium — you build the form, Stripe handles the card
Recurring billing / subscriptionsCheckout Sessions (subscription mode)Low-Medium
Save a card for laterSetup IntentsLow
Marketplace / platform paymentsStripe ConnectHigh
Let customers manage billingCustomer PortalLow — Stripe hosts it

Default recommendation: Start with Checkout Sessions. It's the fastest path to accepting money. You can always add embedded forms later.

Setup

Install

npm install stripe @stripe/stripe-js

API Keys

# Get keys from: https://dashboard.stripe.com/apikeys
# Test keys start with sk_test_ and pk_test_
# Live keys start with sk_live_ and pk_live_

# For Cloudflare Workers — store as secrets:
npx wrangler secret put STRIPE_SECRET_KEY
npx wrangler secret put STRIPE_WEBHOOK_SECRET

# For local dev — .dev.vars:
STRIPE_SECRET_KEY=sk_test_...
STRIPE_WEBHOOK_SECRET=whsec_...
STRIPE_PUBLISHABLE_KEY=pk_test_...

Server-Side Client

import Stripe from 'stripe';

// Cloudflare Workers
const stripe = new Stripe(c.env.STRIPE_SECRET_KEY);

// Node.js
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!);

One-Time Payment (Checkout Sessions)

The fastest way to accept payment. Stripe hosts the entire checkout page.

Create a Checkout Session (Server)

app.post('/api/checkout', async (c) => {
  const { priceId, successUrl, cancelUrl } = await c.req.json();

  const session = await stripe.checkout.sessions.create({
    mode: 'payment',
    line_items: [{ price: priceId, quantity: 1 }],
    success_url: successUrl || `${new URL(c.req.url).origin}/success?session_id={CHECKOUT_SESSION_ID}`,
    cancel_url: cancelUrl || `${new URL(c.req.url).origin}/pricing`,
  });

  return c.json({ url: session.url });
});

Redirect to Checkout (Client)

async function handleCheckout(priceId: string) {
  const res = await fetch('/api/checkout', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ priceId }),
  });
  const { url } = await res.json();
  window.location.href = url;
}

Create Products and Prices

# Via Stripe CLI (recommended for setup)
stripe products create --name="Pro Plan" --description="Full access"
stripe prices create --product=prod_XXX --unit-amount=2900 --currency=aud --recurring[interval]=month

# Or via Dashboard: https://dashboard.stripe.com/products

Hardcode price IDs in your code (they don't change):

const PRICES = {
  pro_monthly: 'price_1234567890',
  pro_yearly: 'price_0987654321',
} as const;

Subscriptions

Same as one-time but with mode: 'subscription':

const session = await stripe.checkout.sessions.create({
  mode: 'subscription',
  line_items: [{ price: PRICES.pro_monthly, quantity: 1 }],
  success_url: `${origin}/dashboard?session_id={CHECKOUT_SESSION_ID}`,
  cancel_url: `${origin}/pricing`,
  // Link to existing customer if known:
  customer: customerId, // or customer_email: 'user@example.com'
});

Check Subscription Status

async function hasActiveSubscription(customerId: string): Promise<boolean> {
  const subs = await stripe.subscriptions.list({
    customer: customerId,
    status: 'active',
    limit: 1,
  });
  return subs.data.length > 0;
}

Webhooks

Stripe sends events to your server when things happen (payment succeeded, subscription cancelled, etc.). You must verify the webhook signature.

Webhook Handler (Cloudflare Workers / Hono)

app.post('/api/webhooks/stripe', async (c) => {
  const body = await c.req.text();
  const sig = c.req.header('stripe-signature')!;

  let event: Stripe.Event;
  try {
    // Use constructEventAsync for Workers (no Node crypto)
    event = await stripe.webhooks.constructEventAsync(
      body,
      sig,
      c.env.STRIPE_WEBHOOK_SECRET
    );
  } catch (err) {
    console.error('Webhook signature verification failed:', err);
    return c.json({ error: 'Invalid signature' }, 400);
  }

  switch (event.type) {
    case 'checkout.session.completed': {
      const session = event.data.object as Stripe.Checkout.Session;
      // Fulfill the order — update database, send email, grant access
      await handleCheckoutComplete(session);
      break;
    }
    case 'customer.subscription.updated': {
      const sub = event.data.object as Stripe.Subscription;
      await handleSubscriptionChange(sub);
      break;
    }
    case 'customer.subscription.deleted': {
      const sub = event.data.object as Stripe.Subscription;
      await handleSubscriptionCancelled(sub);
      break;
    }
    case 'invoice.payment_failed': {
      const invoice = event.data.object as Stripe.Invoice;
      await handlePaymentFailed(invoice);
      break;
    }
  }

  return c.json({ received: true });
});

Register Webhook

# Local testing with Stripe CLI:
stripe listen --forward-to http://localhost:8787/api/webhooks/stripe

# Production — register via Dashboard:
# https://dashboard.stripe.com/webhooks
# URL: https://yourapp.com/api/webhooks/stripe
# Events: checkout.session.completed, customer.subscription.updated,
#          customer.subscription.deleted, invoice.payment_failed

Cloudflare Workers Gotcha

constructEvent (synchronous) uses Node.js crypto which doesn't exist in Workers. Use constructEventAsync instead — it uses the Web Crypto API.

Customer Portal

Let customers manage their own subscriptions (upgrade, downgrade, cancel, update payment method):

app.post('/api/billing/portal', async (c) => {
  const { customerId } = await c.req.json();

  const session = await stripe.billingPortal.sessions.create({
    customer: customerId,
    return_url: `${new URL(c.req.url).origin}/dashboard`,
  });

  return c.json({ url: session.url });
});

Configure the portal in Dashboard: https://dashboard.stripe.com/settings/billing/portal

Pricing Page Pattern

Generate a pricing page that reads from Stripe products:

// Server: fetch products and prices
app.get('/api/pricing', async (c) => {
  const prices = await stripe.prices.list({
    active: true,
    expand: ['data.product'],
    type: 'recurring',
  });

  return c.json(prices.data.map(price => ({
    id: price.id,
    name: (price.product as Stripe.Product).name,
    description: (price.product as Stripe.Product).description,
    amount: price.unit_amount,
    currency: price.currency,
    interval: price.recurring?.interval,
  })));
});

Or hardcode if you only have 2-3 plans — simpler and no API call on every page load.

Stripe CLI (Local Development)

# Install
brew install stripe/stripe-cli/stripe

# Login
stripe login

# Listen for webhooks locally
stripe listen --forward-to http://localhost:8787/api/webhooks/stripe

# Trigger test events
stripe trigger checkout.session.completed
stripe trigger customer.subscription.created
stripe trigger invoice.payment_failed

Common Patterns

Link Stripe Customer to Your User

// On first checkout, create or find customer:
const session = await stripe.checkout.sessions.create({
  customer_email: user.email,  // Creates new customer if none exists
  // OR
  customer: user.stripeCustomerId,  // Use existing
  metadata: { userId: user.id },  // Link back to your user
  // ...
});

// In webhook, save the customer ID:
case 'checkout.session.completed': {
  const session = event.data.object;
  await db.update(users)
    .set({ stripeCustomerId: session.customer as string })
    .where(eq(users.id, session.metadata.userId));
}

Free Trial

const session = await stripe.checkout.sessions.create({
  mode: 'subscription',
  line_items: [{ price: PRICES.pro_monthly, quantity: 1 }],
  subscription_data: {
    trial_period_days: 14,
  },
  // ...
});

Australian Dollars

// Set currency when creating prices
const price = await stripe.prices.create({
  product: 'prod_XXX',
  unit_amount: 2900,  // $29.00 in cents
  currency: 'aud',
  recurring: { interval: 'month' },
});

Gotchas

GotchaFix
constructEvent fails on WorkersUse constructEventAsync (Web Crypto API)
Webhook fires but handler not calledCheck the endpoint URL matches exactly (trailing slash matters)
Test mode payments not appearingMake sure you're using sk_test_ key, not sk_live_
Price amounts are in cents2900 = $29.00. Always divide by 100 for display
Customer email doesn't match userUse customer (existing ID) not customer_email for returning users
Subscription status staleDon't cache — check via API or trust webhook events
Webhook retriesStripe retries failed webhooks for up to 3 days. Return 200 quickly.
CORS on checkout redirectCheckout URL is on stripe.com — use window.location.href, not fetch

Related skills

How it compares

Pick stripe-payments when Claude Code should generate full Stripe npm integrations in-repo instead of routing payments through a separate MCP bridge.

FAQ

Does stripe-payments require a Stripe MCP server?

stripe-payments does not require an MCP server; it integrates Stripe directly through the Stripe npm package and produces working Checkout, subscription, and webhook code in the application.

Which Stripe features does stripe-payments cover?

stripe-payments covers Checkout Sessions, Payment Intents, subscriptions, webhook verification, customer portal setup, and pricing page patterns for web applications.

Is Stripe Payments safe to install?

skills.sh reports 2 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

Backend & APIspaymentsecommercepricing

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.