Backend · How to use a skill

add-stripe-checkout

Adds Stripe Checkout for one-off payments or subscriptions with a server route that creates the session and a verified webhook that fulfils the order. Use when the user wants to take payments, charge cards, sell a product, add a pricing page, subscriptions, or a buy button.

Version 1.0 · Updated 2026-10-30

View raw SKILL.md

Install in Claude Code, Cursor or Codex (optional)

Only for AI coding tools that read skill folders. Run one line in a terminal, in your project folder. It downloads this skill's text files from TheSkillVault and nothing else; you can read them first with “View raw SKILL.md”.

Claude Code (all your projects)

curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/add-stripe-checkout/raw' -o ~/'.claude/skills/add-stripe-checkout/SKILL.md'

Cursor (this project)

curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/add-stripe-checkout/raw' -o '.cursor/skills/add-stripe-checkout/SKILL.md'

Codex and other Agent Skills tools (this project)

curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/add-stripe-checkout/raw' -o '.agents/skills/add-stripe-checkout/SKILL.md'

Or connect the whole library over MCP

Add TheSkillVault to Cursor or add this to your app's MCP settings (read-only; help):

{
  "mcpServers": {
    "theskillvault": {
      "url": "https://theskillvault.ai/mcp"
    }
  }
}

Add Stripe Checkout

When to use

  • Selling something without building a custom card form.

Steps

  1. Create the Product and Price in the Stripe dashboard (test mode); copy the price_... ID.
  2. npm i stripe; set STRIPE_SECRET_KEY and STRIPE_WEBHOOK_SECRET server-side only.
  3. Server route POST /api/checkout: stripe.checkout.sessions.create({ mode: "payment" | "subscription", line_items: [{ price, quantity: 1 }], success_url, cancel_url, client_reference_id: userId }), return session.url, redirect the browser to it.
  4. Webhook route POST /api/stripe/webhook: read the raw body, stripe.webhooks.constructEvent(raw, sig, secret), handle checkout.session.completed (and customer.subscription.* for subs). Fulfil here, not on the success page.
  5. Make fulfilment idempotent: store event.id or session.id and skip duplicates.
  6. Test locally: stripe listen --forward-to localhost:3000/api/stripe/webhook and stripe trigger checkout.session.completed. Card 4242 4242 4242 4242.

Gotchas

  • Parsing the body as JSON before verifying breaks the signature check.
  • Prices come from Stripe, never from the client request.
  • The success page can be reached without paying; never grant access there.

Example prompt

"Add a $29 buy button that unlocks the pro features after payment."

Licence: CC BY 4.0. Attribution when you reuse it: From TheSkillVault, https://theskillvault.ai, CC BY 4.0