Skip to main content
skill CX Codex

adding-stripe — Claude Code skill: Stripe payments in your web app

Walks the agent through Stripe setup: SDK, keys, checkout sessions, webhooks and a customer portal for subscriptions.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add spencerpauly/awesome-cursor-skills --skill adding-stripe -a claude-code
Open on GitHub

What adding-stripe does

The skill fires when you ask for payments, billing, subscriptions or a Stripe integration. The agent installs stripe and @stripe/stripe-js, adds STRIPE_SECRET_KEY, NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY and STRIPE_WEBHOOK_SECRET, then creates a client module at lib/stripe.ts with a pinned API version.

From there it builds a checkout API route, a POST /api/webhooks/stripe handler that verifies the signature with stripe.webhooks.constructEvent, and handlers for checkout.session.completed, customer.subscription.updated, customer.subscription.deleted and invoice.payment_failed. Subscription status goes into your database. The billing portal and pricing page are marked optional.

All three Stripe keys have to exist before anything runs, or the client fails to construct. For local webhook testing the notes point to stripe listen --forward-to localhost:3000/api/webhooks/stripe. The skill also tells you to keep the Stripe customer ID in your user table so repeat buyers don't get duplicate customers, and to pull prices with stripe.prices.list instead of hardcoding them.

What it helps with

  • wire Stripe Checkout into a web app
  • sell one-time payments and subscriptions from the same session
  • verify incoming webhook signatures instead of trusting raw payloads
  • keep subscription status in sync in your database
  • let customers cancel or change a plan in the billing portal

Example prompts for the agent

  • add Stripe subscription payments to my pricing page
  • create the /api/webhooks/stripe handler and update subscription status in the database
  • hook up the customer portal so users can cancel on their own

How to install adding-stripe

1Skills CLI (Vercel)

npx skills add spencerpauly/awesome-cursor-skills --skill adding-stripe -a claude-code

2Manually: put the files in place

~/.claude/skills/adding-stripe/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/adding-stripe/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about adding-stripe

How do I install adding-stripe in Claude?

Run npx skills add spencerpauly/awesome-cursor-skills --skill adding-stripe -a claude-code. The skill lands at ~/.claude/skills/adding-stripe/SKILL.md.

What does adding-stripe do?

It guides the agent through Stripe integration: SDK install, environment variables, the Stripe client, a checkout session, webhooks and the billing portal.

What do I need before using it?

Three Stripe keys: STRIPE_SECRET_KEY, NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY and STRIPE_WEBHOOK_SECRET. Stripe CLI helps for local webhook testing.

Source text

SKILL.md · CC0-1.0
---
name: adding-stripe
description: Integrate Stripe payments into a web application, including checkout sessions, webhooks, and customer portal.
---

# Add Stripe Payments

Use this skill when the user asks to add payments, billing, subscriptions, or Stripe integration.

## Steps

1. **Install the SDK**

   ```bash
   npm install stripe @stripe/stripe-js
   ```

2. **Add environment variables**

   ```
   STRIPE_SECRET_KEY=sk_test_...
   NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_...
   STRIPE_WEBHOOK_SECRET=whsec_...
   ```

3. **Create a Stripe client module** — create `lib/stripe.ts`:

   ```ts
   import Stripe from "stripe";

   export const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!, {
     apiVersion: "2024-12-18.acacia",
   });
   ```

4. **Create a checkout API route** — create an endpoint that creates a Stripe Checkout session:

   ```ts
   const session = await stripe.checkout.sessions.create({
     mode: "subscription", // or "payment" for one-time
     payment_method_types: ["card"],
     line_items: [{ price: priceId, quantity: 1 }],
     success_url: `${origin}/success?session_id={CHECKOUT_SESSION_ID}`,
     cancel_url: `${origin}/pricing`,
     customer_email: userEmail,
   });
   return redirect(session.url!);
   ```

5. **Create a webhook handler** — create a `POST` endpoint at `/api/webhooks/stripe`:

   - Verify the webhook signature using `stripe.webhooks.constructEvent`.
   - Handle key events: `checkout.session.completed`, `customer.subscription.updated`, `customer.subscription.deleted`, `invoice.payment_failed`.
   - Update your database with the subscription status.

6. **Add customer portal (optional)** — create an endpoint that redirects to `stripe.billingPortal.sessions.create` so users can manage their subscription.

7. **Add pricing page UI** — create a pricing page with plan cards that call the checkout API route.

## Notes

- Always verify webhook signatures — never trust unverified payloads.
- Use Stripe CLI (`stripe listen --forward-to localhost:3000/api/webhooks/stripe`) for local webhook testing.
- Store the Stripe customer ID in your user database to avoid creating duplicate customers.
- Use `stripe.prices.list` to fetch prices dynamically instead of hardcoding them.

© spencerpauly · CC0-1.0 · spencerpauly/awesome-cursor-skills

Similar skills

All skills for Backend and APIs →

From the same set60

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor