Token导航 LogoToken导航TokenDH.com
研究检索敏感数据github未标认证来源可访问clear审计未展示

stripeStripe 支付

Agent Skill

stripe 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

306

周安装

13

GitHub Stars

公开资料未说明

下载量

107
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:stripe(Stripe 支付)
来源仓库:https://github.com/velcrafting/codex-skills
仓库路径:skills/stripe
安装命令:
npx skills add velcrafting/codex-skills --skill "stripe"
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

AgentSkills.tonpx skills
npx skills add velcrafting/codex-skills --skill "stripe"

简介

stripe 用于快速查找、检索和筛选 Stripe 支付相关信息,提升支付集成效率。

  • 适合在 Codex、Claude、Cursor、Gemini CLI 中根据关键词或任务场景定位相关内容。
  • 通过 npx skills add velcrafting/codex-skills --skill "stripe" 安装,具体用法请参考原始 README。
  • 安装前建议确认权限范围、维护状态及是否会触发联网、命令执行或文件读写。
  • 可结合来源仓库和安装命令进一步核验实际功能与使用方式。

SKILL.md

name
stripe
description
>-
version
1.1.0

Stripe Integration Expert

Comprehensive guidance for integrating Stripe payments including subscriptions, usage-based billing, webhooks, and multi-platform support (Next.js, iOS, Android, Flutter) with Supabase database synchronization.

Philosophy: Use Stripe Checkout for simplicity, Payment Intents for customization. Always verify webhooks. For Supabase sync, prefer Stripe Sync Engine (one-click, zero maintenance) unless you need custom schemas. Never expose secret keys to clients.

Critical Rules

API Keys Security

Key TypePrefixSafetyUse Case
Publishablepk_live_ / pk_test_Client-safeBrowser, mobile apps
Secretsk_live_ / sk_test_Backend ONLYServers, Edge Functions
Restrictedrk_live_ / rk_test_Backend ONLYLimited permissions
Webhook Secretwhsec_Backend ONLYSignature verification

NEVER:

  • Expose secret keys in client code
  • Commit keys to version control
  • Log full API keys
  • Use secret keys in browser/mobile apps

ALWAYS:

  • Use environment variables for all keys
  • Use publishable key for client-side Stripe.js
  • Use restricted keys for specific operations
  • Rotate keys immediately if compromised

Webhook Security (CRITICAL)

// CORRECT: Use raw body for signature verification
const body = await req.text()  // Raw string, NOT parsed
const signature = req.headers.get('stripe-signature')!
const event = stripe.webhooks.constructEvent(body, signature, webhookSecret)

// WRONG: This will FAIL signature verification
const body = await req.json()  // DON'T parse first!

Webhook Rules:

  • ALWAYS verify signatures before processing
  • Use raw request body (NOT parsed JSON)
  • Implement idempotency (track processed events)
  • Return 200 quickly, process asynchronously
  • Handle retries gracefully

PCI Compliance

  • NEVER collect card numbers directly on your server
  • ALWAYS use Stripe.js, Elements, or Checkout
  • Use Payment Intents or Checkout Sessions
  • Enable SCA for EU customers (automatic with Checkout)
  • Log payment events but NEVER log card details

Quick Reference

Subscription Billing Models

ModelUse CaseImplementation
Flat RateFixed monthly/yearlySingle price, licensed
Per-SeatPer user pricingquantity on subscription
Usage-BasedPay for consumptionMeters + metered billing
TieredVolume discountstiered pricing
HybridBase + usageMultiple prices on subscription

Essential Webhook Events

EventWhenAction
checkout.session.completedSuccessful checkoutProvision access
customer.subscription.createdNew subscriptionCreate local record
customer.subscription.updatedPlan change/renewalUpdate local record
customer.subscription.deletedCancellationRevoke access
invoice.paidSuccessful paymentUpdate billing status
invoice.payment_failedPayment failureNotify customer

Environment Variables

# .env.local (Next.js)
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_...
STRIPE_SECRET_KEY=sk_test_...
STRIPE_WEBHOOK_SECRET=whsec_...

# Supabase Edge Functions
# Set via: supabase secrets set STRIPE_SECRET_KEY=sk_test_...

Workflow Decision Tree

User mentions Stripe/payments?
├─> Setting up Stripe?
│   └─> Use: Initial Setup (below)
├─> Creating subscriptions?
│   ├─> Simple flat rate?
│   │   └─> Use: Checkout Session pattern
│   ├─> Per-seat pricing?
│   │   └─> See: references/subscriptions.md
│   └─> Usage-based/metered?
│       └─> See: references/subscriptions.md
├─> Handling webhooks?
│   └─> See: references/webhooks.md
├─> Next.js integration?
│   └─> See: references/nextjs-integration.md
├─> Mobile integration?
│   └─> See: references/mobile-integration.md
├─> Syncing with Supabase?
│   ├─> Zero-maintenance sync? (Recommended)
│   │   └─> Use: Stripe Sync Engine (references/supabase-sync.md)
│   ├─> Custom schema/transformations?
│   │   └─> Use: Webhook Sync (references/supabase-sync.md)
│   └─> Real-time admin queries?
│       └─> Use: Stripe Wrapper FDW (references/supabase-sync.md)
└─> MRR/Revenue analytics?
    └─> See: references/supabase-sync.md (Business Analytics Queries)

Initial Setup

1. Install Dependencies

Next.js:

npm install stripe @stripe/stripe-js

iOS (Swift Package Manager):

https://github.com/stripe/stripe-ios

Android (Gradle):

implementation("com.stripe:stripe-android:20.+")

Flutter:

dependencies:
  flutter_stripe: ^11.0.0

2. Initialize Stripe

Server (Next.js):

// lib/stripe/server.ts
import Stripe from 'stripe'

export const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!, {
  apiVersion: '2024-12-18.acacia',
  typescript: true,
})

Client (Next.js):

// lib/stripe/client.ts
import { loadStripe, Stripe } from '@stripe/stripe-js'

let stripePromise: Promise<Stripe | null>

export function getStripe() {
  if (!stripePromise) {
    stripePromise = loadStripe(process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY!)
  }
  return stripePromise
}

Checkout Session Quick Reference

Server Action (Next.js):

'use server'

import { redirect } from 'next/navigation'
import { stripe } from '@/lib/stripe/server'
import { createClient } from '@/lib/supabase/server'

export async function createCheckoutSession(priceId: string) {
  const supabase = await createClient()
  const { data: { user } } = await supabase.auth.getUser()

  if (!user) {
    redirect('/login')
  }

  // Get or create Stripe customer
  const { data: customer } = await supabase
    .from('customers')
    .select('stripe_customer_id')
    .eq('user_id', user.id)
    .single()

  const session = await stripe.checkout.sessions.create({
    customer: customer?.stripe_customer_id,
    customer_email: !customer ? user.email : undefined,
    mode: 'subscription',
    payment_method_types: ['card'],
    line_items: [{ price: priceId, quantity: 1 }],
    success_url: `${process.env.NEXT_PUBLIC_APP_URL}/success?session_id={CHECKOUT_SESSION_ID}`,
    cancel_url: `${process.env.NEXT_PUBLIC_APP_URL}/pricing`,
    metadata: {
      user_id: user.id,
    },
  })

  redirect(session.url!)
}

Customer Portal Quick Reference

'use server'

import { redirect } from 'next/navigation'
import { stripe } from '@/lib/stripe/server'
import { createClient } from '@/lib/supabase/server'

export async function createPortalSession() {
  const supabase = await createClient()
  const { data: { user } } = await supabase.auth.getUser()

  if (!user) {
    redirect('/login')
  }

  const { data: customer } = await supabase
    .from('customers')
    .select('stripe_customer_id')
    .eq('user_id', user.id)
    .single()

  if (!customer?.stripe_customer_id) {
    redirect('/pricing')
  }

  const session = await stripe.billingPortal.sessions.create({
    customer: customer.stripe_customer_id,
    return_url: `${process.env.NEXT_PUBLIC_APP_URL}/settings/billing`,
  })

  redirect(session.url)
}

Webhook Handler Quick Reference

// app/api/webhooks/stripe/route.ts
import { headers } from 'next/headers'
import { stripe } from '@/lib/stripe/server'
import { createClient } from '@supabase/supabase-js'

const supabaseAdmin = createClient(
  process.env.NEXT_PUBLIC_SUPABASE_URL!,
  process.env.SUPABASE_SECRET_KEY!
)

export async function POST(req: Request) {
  const body = await req.text()
  const headersList = await headers()
  const signature = headersList.get('stripe-signature')!

  let event

  try {
    event = stripe.webhooks.constructEvent(
      body,
      signature,
      process.env.STRIPE_WEBHOOK_SECRET!
    )
  } catch (err: any) {
    console.error('Webhook signature verification failed:', err.message)
    return new Response(`Webhook Error: ${err.message}`, { status: 400 })
  }

  // Idempotency check
  const { data: existing } = await supabaseAdmin
    .from('stripe_events')
    .select('stripe_event_id')
    .eq('stripe_event_id', event.id)
    .single()

  if (existing) {
    return new Response(JSON.stringify({ received: true, cached: true }))
  }

  // Handle the event
  try {
    switch (event.type) {
      case 'checkout.session.completed':
        await handleCheckoutComplete(event.data.object)
        break
      case 'customer.subscription.created':
      case 'customer.subscription.updated':
        await handleSubscriptionChange(event.data.object)
        break
      case 'customer.subscription.deleted':
        await handleSubscriptionDeleted(event.data.object)
        break
      case 'invoice.payment_failed':
        await handlePaymentFailed(event.data.object)
        break
    }

    // Record processed event
    await supabaseAdmin
      .from('stripe_events')
      .insert({
        stripe_event_id: event.id,
        type: event.type,
      })

  } catch (err) {
    console.error('Error processing webhook:', err)
    return new Response('Webhook handler failed', { status: 500 })
  }

  return new Response(JSON.stringify({ received: true }))
}

Subscription Check in Proxy

// proxy.ts
import { createServerClient } from '@supabase/ssr'
import { NextResponse, type NextRequest } from 'next/server'

export async function proxy(request: NextRequest) {
  // ... Supabase client setup ...

  const { data: { user } } = await supabase.auth.getUser()

  // Check subscription for premium routes
  if (user && request.nextUrl.pathname.startsWith('/dashboard')) {
    const { data: subscription } = await supabase
      .from('subscriptions')
      .select('status, current_period_end')
      .eq('customer_id', user.id)
      .in('status', ['active', 'trialing'])
      .single()

    if (!subscription) {
      return NextResponse.redirect(new URL('/pricing', request.url))
    }
  }

  return supabaseResponse
}

Pre-Flight Checklist

Before ANY Stripe integration:

  • [ ] Secret key in environment variables only
  • [ ] Publishable key for client-side code
  • [ ] Webhook secret configured
  • [ ] Webhook signature verification implemented
  • [ ] Idempotency handling for webhooks
  • [ ] Using Stripe.js for card collection (PCI compliance)
  • [ ] Test mode keys for development
  • [ ] Customer portal configured in Stripe Dashboard
  • [ ] Supabase tables created for sync
  • [ ] RLS policies on Stripe-synced tables
  • [ ] Error handling for all Stripe API calls

Resources

Reference Files (Load as needed)

  • references/subscriptions.md - Billing models, lifecycle, per-seat, usage-based
  • references/webhooks.md - Signature verification, event handling, idempotency
  • references/nextjs-integration.md - Complete Next.js patterns
  • references/mobile-integration.md - iOS, Android, Flutter integration
  • references/supabase-sync.md - Database schema, sync patterns, RLS

Common Mistakes to Avoid

  1. Parsing body before signature verification - Use raw text body
  2. Not implementing idempotency - Events can be sent multiple times
  3. Exposing secret keys in client code - Use publishable keys only
  4. Collecting card numbers directly - Always use Stripe.js/Elements
  5. Not handling subscription status changes - Sync via webhooks
  6. Hardcoding prices - Use Stripe Dashboard or API for prices
  7. Not testing webhooks locally - Use stripe listen --forward-to
  8. Missing error handling - Stripe API can fail

Testing

Local Webhook Testing

# Install Stripe CLI
brew install stripe/stripe-cli/stripe

# Login
stripe login

# Forward webhooks to local server
stripe listen --forward-to localhost:3000/api/webhooks/stripe

# Trigger test events
stripe trigger checkout.session.completed
stripe trigger customer.subscription.updated

Test Card Numbers

CardNumberUse Case
Success4242 4242 4242 4242Successful payment
Decline4000 0000 0000 0002Card declined
Auth Required4000 0025 0000 31553D Secure required
Insufficient Funds4000 0000 0000 9995Insufficient funds

Skill Version: 1.0.0 Last Updated: 2025-01-07 Documentation: https://docs.stripe.com

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

29.6%
按下载量换算32

windsurf

21.8%
按下载量换算23

trae

17.29%
按下载量换算19

OpenCode

12.88%
按下载量换算14

Codex

6.79%
按下载量换算7

Antigravity

3.56%
按下载量换算4

安全审计

暂无安全审计结果可展示。

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills