stripe

Use when adding payments, billing, checkout, subscriptions, invoices, webhooks, customer portal, Stripe Connect, metered/usage billing, tax, fraud/Radar, pricing page, payment intents, refunds, coupons, promo codes, or any Stripe integration in Next.js. Triggers: stripe, payment, checkout, subscribe, billing, invoice, webhook, portal, connect, marketplace, payout, metered, usage-based, SaaS pricing, paywall, plan, tier.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "stripe" with this command: npx skills add clownnvd/claude-code-skills/clownnvd-claude-code-skills-stripe

Stripe — Next.js App Router

Complete Stripe integration patterns for Next.js App Router with Server Actions and Route Handlers.

Setup (3 steps)

Step 1: Install

npm install stripe @stripe/stripe-js @stripe/react-stripe-js

Step 2: Environment variables

Copy templates/env-example.txt.env.local and fill in your keys from Stripe Dashboard.

Env VariableValueExposed to Client
STRIPE_SECRET_KEYsk_test_... or sk_live_...NO
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEYpk_test_... or pk_live_...Yes
STRIPE_WEBHOOK_SECRETwhsec_...NO
NEXT_PUBLIC_APP_URLhttp://localhost:3000Yes

Step 3: Initialize SDK

Copy templates/stripe-server.tslib/stripe.ts and templates/stripe-client.tslib/stripe-client.ts.

Load references/setup.md for details.

Quick Patterns

TaskApproachReference
One-time paymentCheckout Session → redirect to Stripereferences/checkout.md
Custom payment UIPayment Intents + Stripe Elementsreferences/payment-intents.md
Recurring billingSubscriptions + Invoicesreferences/subscriptions.md
Receive eventsWebhook Route Handlerreferences/webhooks.md
Self-service billingCustomer Portal sessionreferences/customer-portal.md
Products & pricingProducts + Prices APIreferences/products-prices.md
Marketplace splitsStripe Connectreferences/connect.md
Auto tax calcStripe Taxreferences/tax.md
Fraud preventionRadar rules + 3D Securereferences/radar-fraud.md
Usage-based billingBilling Meter + usage recordsreferences/billing-meter.md
Pricing pageServer-fetched prices + checkout buttonreferences/pricing-page.md
Stripe ↔ DB syncWebhook → database update patternsreferences/database-sync.md
Paywall / auth guardMiddleware + Server Component guardsreferences/middleware-guard.md

Essential Webhook Events

EventWhenAction
checkout.session.completedPayment capturedFulfill order
invoice.paidSubscription renewedExtend access
invoice.payment_failedPayment failedNotify user, retry
customer.subscription.updatedPlan changedUpdate entitlements
customer.subscription.deletedCancelledRevoke access
payment_intent.succeededCustom flow completedConfirm order
charge.dispute.createdDispute openedAlert + evidence

Load references/webhooks.md for handler implementation.

Test Cards

NumberResult
4242 4242 4242 4242Success
4000 0000 0000 0002Generic decline
4000 0000 0000 9995Insufficient funds
4000 0000 0000 0069Expired card
4000 0025 0000 31553D Secure required
4000 0000 0000 32203D Secure 2 required

Load references/testing.md for full test cards + Stripe CLI workflow.

Stripe CLI

stripe login
stripe listen --forward-to localhost:3000/api/webhooks/stripe
stripe trigger checkout.session.completed
stripe trigger invoice.payment_failed
stripe logs tail --filter status:400

Templates

TemplateCopy ToDescription
templates/stripe-server.tslib/stripe.tsServer-side Stripe instance
templates/stripe-client.tslib/stripe-client.tsClient-side Stripe.js (lazy)
templates/webhook-handler.tsapp/api/webhooks/stripe/route.tsWebhook Route Handler
templates/checkout-action.tsapp/actions/checkout.tsServer Action: Checkout Session
templates/subscription-action.tsapp/actions/subscription.tsServer Actions: subscription CRUD
templates/customer-portal-action.tsapp/actions/portal.tsServer Action: portal session
templates/env-example.txt.env.localEnvironment variables

Error Handling

Load references/error-handling.md for Stripe error types and retry patterns.

Security

Load references/security.md for PCI compliance, idempotency, and key management.

All References

  • references/setup.md — SDK init, singleton, TypeScript config
  • references/checkout.md — Checkout Sessions, hosted vs embedded
  • references/payment-intents.md — Payment Intents, 3D Secure, capture
  • references/subscriptions.md — Recurring billing, trials, proration
  • references/webhooks.md — Signature verification, event routing, idempotency
  • references/customer-portal.md — Self-service portal setup
  • references/products-prices.md — Products, Prices, coupons, promo codes
  • references/connect.md — Marketplace, platform fees, payouts
  • references/tax.md — Automatic tax calculation
  • references/radar-fraud.md — Fraud detection, disputes
  • references/billing-meter.md — Usage-based billing
  • references/error-handling.md — Error types, retry logic
  • references/testing.md — Test cards, CLI, test clocks
  • references/security.md — PCI, keys, idempotency, CSP
  • references/pricing-page.md — Pricing page component pattern
  • references/database-sync.md — Stripe ↔ DB sync patterns
  • references/middleware-guard.md — Auth middleware for paid routes

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

ui-ux-pro-max

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

prisma-better-auth-nextjs

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

vercel-react-best-practices

No summary provided by upstream source.

Repository SourceNeeds Review