Integrating Stripe Payments

VerifiedCaution

Complete workflow for integrating Stripe payments (subscriptions or one-time) with Convex + Next.js. Includes hosted checkout, webhooks, UI components, and testing. Use when adding payment functionality to a Convex + Next.js app.

Sby Skills Guide Bot
DevelopmentAdvanced
3/4/2026
Claude Code
#stripe#payments#convex#nextjs#webhooks

Recommended for

Automated summary

This skill drives a full Stripe payments integration (subscriptions or one-time) into a Convex + Next.js app, covering hosted checkout, webhooks, UI components, and testing.

Strengths

  • Walks through an ordered 8-step workflow from API keys to production deployment
  • Ships copy-ready reference files for the Convex schema, Stripe actions, webhook handler, and UI components
  • Captures real pitfalls: constructEventAsync, consistent API version, allow_promotion_codes, and current_period_end fallbacks
  • Covers webhook endpoint setup plus a testing checklist using the Stripe CLI

Limitations

  • Assumes a Convex + Next.js stack and access to the Stripe and Convex MCP tools
  • Does not cover embedded checkout flows or complex pricing models such as usage-based billing or multi-currency
  • Code snippets live in resources/ and are not included inside the SKILL.md itself
When to use it

Use it when you need to add subscription or one-time Stripe payment functionality to an existing Convex and Next.js application.

When not to use it

Avoid it on projects that do not use Convex or Next.js, or when a simple Stripe Payment Link would already do the job.

Security analysis

Caution
Quality score88/100

The skill describes a legitimate Stripe + Convex + Next.js integration workflow and does not instruct destructive, exfiltrating, or obfuscated actions. The main risk is ordinary secret handling and use of bash/network MCP tools, which warrants caution rather than a risky rating.

Findings
  • •Instructs collecting a Stripe secret key from the user and writing it to `.env.local`; secret handling must ensure `.env.local` is gitignored and never logged or committed.
  • •Uses `bash` for dependency installation and MCP tools with network access for Stripe/Convex configuration; legitimate but powerful capabilities.
  • •References bundled `resources/` code files that are not included in the provided SKILL.md, so those files should be reviewed before publishing.
How this analysis is made

Examples

Add subscription billing
Add a monthly $19 subscription to my Convex + Next.js app using Stripe hosted checkout, including the webhook handler and an upgrade button.
One-time payment
I want to sell a one-time $49 lifetime access product in my Convex + Next.js app with Stripe Checkout — set up the backend, webhook, and upgrade UI.
Wire up webhooks
Configure the Stripe webhook endpoint for my Convex deployment so checkout.session.completed and subscription events keep membership status in sync.

name: Integrating Stripe Payments description: Complete workflow for integrating Stripe payments (subscriptions or one-time) with Convex + Next.js. Includes hosted checkout, webhooks, UI components, and testing. Use when adding payment functionality to a Convex + Next.js app. version: "1.0.0" dependencies: ["stripe", "convex", "next.js"] allowed-tools: ["stripe-mcp", "convex-mcp", "file_write", "bash"]

Integrating Stripe Payments

Core Workflow

When user requests Stripe payment integration for Convex + Next.js:

1. Requirements Gathering

Ask these questions first:

  • Payment type: Subscription or one-time payment?
  • Backend: Confirm this is Convex (required for this skill)
  • Checkout preference: Hosted Stripe Checkout (recommended) or embedded?
  • Pricing: Amount, currency, billing interval for subscriptions?
  • Product: What does user get after payment?

2. API Keys & Environment Setup

CRITICAL: Gather these FIRST before proceeding - MCP tools require credentials.

  1. Get Stripe API keys from user:

    • Ask for Stripe Secret Key (starts with sk_test_ or sk_live_)
    • Add to .env.local: STRIPE_SECRET_KEY=sk_test_...
  2. Install dependencies: npm install stripe

  3. Set initial environment variables:

    • STRIPE_SECRET_KEY (from step 1)
    • NEXT_PUBLIC_SITE_URL=http://localhost:3000 (default local development)
  4. Use Stripe MCP tool to create product/price and get price ID

  5. Use Convex MCP tool to set remaining environment variables

  6. Manual fallback: Follow resources/environment-setup.md

Complete required env vars:

  • STRIPE_SECRET_KEY ✓ (set in step 1)
  • STRIPE_PRICE_ID (from Stripe MCP tool)
  • STRIPE_WEBHOOK_SECRET (set during webhook configuration)
  • NEXT_PUBLIC_SITE_URL ✓ (set in step 1)

3. Database Schema

Update convex/schema.ts with Stripe fields. See resources/database-schema.ts for complete schema.

4. Backend Implementation

Copy and customize these files:

  • convex/stripe.ts ← Use resources/convex-stripe-actions.ts
  • convex/stripeDb.ts ← Use resources/convex-stripe-db.ts
  • convex/http.ts ← Use resources/convex-webhook-handler.ts

Key customizations:

  • Update membership tier names ("pro" vs "premium")
  • Adjust auth field names (clerkId vs your auth system)
  • Set correct API version: 2025-08-27.basil
  • Enable coupon codes by setting allow_promotion_codes: true in checkout session creation

5. Frontend Components

Create UI components from resources/ui-components.tsx:

  • UpgradeButton - Shows different states based on membership
  • ManageBillingButton - Opens customer portal

UI Design Guidelines:

  • Match existing app design system
  • Use gradients and proper state management
  • Show loading states and error handling
  • Keep prices in sync with Stripe Dashboard

6. Webhook Configuration

  1. Get Convex deployment URL (use .convex.site domain)
  2. Create webhook in Stripe Dashboard: https://your-deployment.convex.site/stripe/webhook
  3. Select events: checkout.session.completed, customer.subscription.*, invoice.*
  4. Copy webhook secret to environment variables

7. Testing

Follow resources/testing-checklist.md:

  • Test successful payment flow
  • Test failed payments
  • Test customer portal
  • Verify webhook delivery
  • Use Stripe CLI for local testing

8. Production Deployment

  • Switch to live Stripe keys
  • Create production webhook endpoint
  • Configure Customer Portal and Smart Retries
  • Test with real payment (then refund)

Best Practices

Always:

  • Use hosted checkout for simplicity and security
  • Use constructEventAsync in webhooks (not constructEvent)
  • Include user metadata in checkout sessions
  • Handle missing current_period_end with fallbacks
  • Keep UI prices synchronized with Stripe prices
  • Use consistent Stripe API version across all files
  • Set allow_promotion_codes: true to enable coupon code input during checkout

Never:

  • Use .convex.cloud for webhooks (use .convex.site)
  • Skip webhook idempotency in production
  • Forget to configure Customer Portal
  • Deploy without testing webhook delivery

Common Issues

Webhook not working: Check domain (.convex.site) and webhook secret Membership not updating: Verify webhook events and metadata API errors: Ensure consistent API version usage

Documentation References

Use Stripe MCP tool for latest documentation when:

  • Checking API changes or new features
  • Troubleshooting integration issues
  • Verifying best practices

See resources/ folder for complete code examples and detailed setup instructions.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/integrating-stripe-payments-mmbizjvz/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/integrating-stripe-payments-mmbizjvz' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/integrating-stripe-payments-mmbizjvz/download' --output '.skill-downloads/integrating-stripe-payments-mmbizjvz/SKILL.md.part' && mv '.skill-downloads/integrating-stripe-payments-mmbizjvz/SKILL.md.part' '.skill-downloads/integrating-stripe-payments-mmbizjvz/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

This file does not provide a usable name/description header for this native procedure. It remains available to download and inspect; use the manual method below.

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/integrating-stripe-payments-mmbizjvz/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills