stripe-implementer

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Stripe Implementer

Stripe 集成实现专家

Expert in comprehensive Stripe integrations including payment processing, subscriptions, webhooks, and customer management for Next.js and NestJS.
精通在Next.js和NestJS中进行全面的Stripe集成,包括支付处理、订阅、Webhook以及客户管理。

When to Use This Skill

何时使用此技能

Use when you're:
  • Integrating Stripe payments
  • Implementing subscription billing
  • Setting up Stripe webhooks
  • Managing Stripe customers
  • Handling payment intents or checkout sessions
  • Implementing Stripe Connect or marketplace features
当你需要以下操作时使用:
  • 集成Stripe支付
  • 实现订阅计费
  • 设置Stripe Webhook
  • 管理Stripe客户
  • 处理支付意向或结账会话
  • 实现Stripe Connect或市场功能

Quick Setup

快速设置

bash
npm install stripe @stripe/stripe-js
env
STRIPE_SECRET_KEY=sk_test_...
STRIPE_PUBLISHABLE_KEY=pk_test_...
STRIPE_WEBHOOK_SECRET=whsec_...
bash
npm install stripe @stripe/stripe-js
env
STRIPE_SECRET_KEY=sk_test_...
STRIPE_PUBLISHABLE_KEY=pk_test_...
STRIPE_WEBHOOK_SECRET=whsec_...

Key Flows

关键流程

Payment Methods

支付方式

  • Checkout Sessions: Recommended for one-time payments
  • Payment Intents: For custom payment flows
  • Subscriptions: For recurring billing
  • 结账会话(Checkout Sessions):推荐用于一次性支付
  • 支付意向(Payment Intents):用于自定义支付流程
  • 订阅(Subscriptions):用于定期计费

Webhook Events

Webhook 事件

  • payment_intent.succeeded
    /
    payment_intent.payment_failed
  • customer.subscription.created/updated/deleted
  • invoice.payment_succeeded/failed
  • payment_intent.succeeded
    /
    payment_intent.payment_failed
  • customer.subscription.created/updated/deleted
  • invoice.payment_succeeded/failed

Best Practices

最佳实践

  • Never expose secret keys client-side
  • Always verify webhook signatures
  • Use idempotency keys for critical operations
  • Test with Stripe CLI:
    stripe listen --forward-to localhost:3000/api/webhooks/stripe
  • 切勿在客户端暴露密钥
  • 始终验证Webhook签名
  • 对关键操作使用幂等键
  • 使用Stripe CLI测试:
    stripe listen --forward-to localhost:3000/api/webhooks/stripe

References

参考资料

  • Full guide: Setup, payments, subscriptions, webhooks, NestJS
  • 完整指南:设置、支付、订阅、Webhook、NestJS