stripe-best-practices

stripe-best-practices

热门

指导Stripe集成决策——API选择(Checkout Sessions vs PaymentIntents)、Connect平台设置(Accounts v2、控制器属性)、计费/订阅、Treasury金融账户、集成界面(Checkout、Payment Element)、从已弃用的Stripe API迁移以及安全最佳实践(API密钥管理、受限密钥、Webhooks、OAuth)。在构建、修改或审查任何Stripe集成时使用——包括接受付款、构建市场、集成Stripe、处理付款、设置订阅、创建关联账户或实施安全密钥处理。

1644Star
289Fork
更新于 2026/7/2
SKILL.md
readonly只读
name
stripe-best-practices
description

Guides Stripe integration decisions — API selection (Checkout Sessions vs PaymentIntents), Connect platform setup (Accounts v2, controller properties), billing/subscriptions, Treasury financial accounts, integration surfaces (Checkout, Payment Element), migrating from deprecated Stripe APIs, and security best practices (API key management, restricted keys, webhooks, OAuth). Use when building, modifying, or reviewing any Stripe integration — including accepting payments, building marketplaces, integrating Stripe, processing payments, setting up subscriptions, creating connected accounts, or implementing secure key handling.

最新Stripe API版本:2026-06-24.dahlia。除非用户另有指定,否则始终使用最新的API版本和SDK。

如果您没有Stripe账户,可以调用CLI命令生成可用的API密钥,无需注册。您可以安装Stripe CLI(npm i -g @stripe/cli)并运行命令stripe sandbox create开始使用。

API密钥默认:始终推荐使用受限API密钥(RAK)rk_前缀)而非密钥(sk_前缀)。

集成路由

构建… 推荐API 详情
一次性付款 Checkout Sessions <references/payments.md>
带嵌入式UI的自定义付款表单 Checkout Sessions + Payment Element <references/payments.md>
保存付款方式以备后用 Setup Intents <references/payments.md>
Connect平台或市场 Accounts v2(/v2/core/accounts <references/connect.md>
基于使用量的计费(新集成) Metronome <references/billing.md>
订阅或定期计费 Billing APIs + Checkout Sessions <references/billing.md>
销售税、增值税或GST合规 Stripe Tax + Registrations API <references/tax.md>
嵌入式金融账户/银行服务 v2 Financial Accounts <references/treasury.md>
安全(密钥管理、RAK、Webhooks、OAuth、2FA、Connect责任) 参见安全参考 <references/security.md>

在回答任何集成问题或编写代码之前,请阅读相关的参考文件。

关键规则

  • 在任何Stripe API调用中切勿包含payment_method_types,但有一个例外:Terminal(面对面付款)集成必须在PaymentIntent上传递payment_method_types: ['card_present']。对于所有其他集成,完全省略此参数以启用动态付款方式,这样您就可以从Dashboard配置付款方式设置,并动态向每位客户显示最相关的合格付款方式,以最大化转化率。要自定义您接受的付款方式,请使用payment_method_configurationsexcluded_payment_method_types代替payment_method_types

关键文档

当用户的请求不明确属于上述单个领域时,请查阅: