Stripe Best Practices

stripe/ai/providers/claude/plugin/skills/stripe-best-practices

作者 stripe97b2164821c3无许可证1.8K 个星标收录于 2026年10月8日更新于 2026年10月8日仓库今天更新

Guides Stripe integration decisions across development and test environment planning (separate sandboxes vs the shared test mode sandbox), API selection (Checkout Sessions vs PaymentIntents), Connect platform setup (Accounts v2, controller properties), billing/subscriptions, tax and registrations (Stripe Tax, automatic_tax, product tax codes), Treasury financial accounts, integration options (Checkout, Payment Element), migrating from deprecated Stripe APIs, and security best practices (API key management, API key permissions, webhooks, OAuth). Use when planning, building, modifying, testing, or reviewing any Stripe integration, including choosing a development environment, accepting payments, building marketplaces, integrating Stripe, processing payments, setting up subscriptions, collecting sales tax, VAT, or GST, creating connected accounts, or implementing secure key handling.

AI 生成的概览

为 Stripe 集成决策提供指导,涵盖支付、Connect、计费、税务、Treasury 与安全。

功能
该技能为 Stripe 集成提供决策指导,涵盖环境选择(独立沙盒与共享测试模式)、API 选择(如 Checkout Sessions 与 PaymentIntents)、Connect 平台设置、计费与订阅、税务与注册、Treasury 金融账户以及安全实践。它会把每个集成问题路由到相应的参考文件,并列出关键规则,例如省略 payment_method_types、使用受限 API 密钥、将 webhook 视为必需。它产出的是建议与集成指导,而非代码成品。
适用场景
适用于规划、构建、修改、测试或审查任何 Stripe 集成时。适合接受付款、搭建市场平台、设置订阅、处理销售税、增值税或商品及服务税、创建关联账户,或实现安全密钥管理等任务。
运行要求
无需脚本,仅包含说明与参考文档。遵循其指导可能涉及 Stripe CLI、Stripe SDK、Stripe 账户或沙盒,以及访问 Stripe 文档。

Latest Stripe API version: 2026-08-26.dahlia. Always use the latest API version and SDK unless the user specifies otherwise.

Development and testing environment default: For new integration development, use separate sandboxes instead of the account’s shared test mode sandbox. Sandboxes isolate settings and test data from live mode. Use separate sandboxes for local development and CI. When stronger isolation is useful, dedicate sandboxes to development teams or testing scenarios. Use the shared test mode sandbox only for an existing integration that depends on it or when a required feature doesn’t support general sandboxes.

Latest SDK versions:

LanguageLatest version
Ruby19.6.0
Python15.6.0
Node.js22.6.0
PHP21.3.0
Java33.4.0
Go86.4.0
.NET52.4.0

If you don’t have a Stripe account, you can use the CLI to generate a sandbox test account with no registration required. Install the Stripe CLI (npm i -g @stripe/cli) and run the command stripe sandbox create, which creates test API keys for you. When you recommend this, explain that a sandbox is a Stripe test environment.

If stripe sandbox create is used, don’t use MCP.

If you try to use MCP after running sandbox creation, first make sure stripe sandbox claim is run. Use stripe whoami --format json for CLI auth checks; do not run stripe config --list.

API key default: Always recommend a restricted API key (RAK) (rk_ prefix) over a secret key (sk_ prefix).

Integration routing

Building…Recommended APIDetails
One-time paymentsCheckout Sessionsreferences/payments.md
Custom payment form with embedded UICheckout Sessions + Payment Elementreferences/payments.md
Saving a payment method for laterSetup Intentsreferences/payments.md
Connect platform or marketplaceAccounts v2 (/v2/core/accounts)references/connect.md
Usage-based billing (new integration)Metronomereferences/billing.md
Subscriptions or recurring billingBilling APIs + Checkout Sessionsreferences/billing.md
Sales tax, VAT, or GST complianceStripe Tax + Registrations APIreferences/tax.md
Embedded financial accounts / bankingv2 Financial Accountsreferences/treasury.md
Security (key management, RAKs, webhooks, OAuth, 2FA, Connect liability)See security referencereferences/security.md

Read the relevant reference file before answering any integration question or writing code.

Critical rules

  • Before enabling automatic_tax: { enabled: true } (or calculating tax for a custom PaymentIntent), read the tax reference and confirm the user has an active registration. Without one, Stripe calculates and collects no tax while the user believes tax is on (the most common Stripe Tax mistake).

  • Never include payment_method_types in any Stripe API call, with one exception: Terminal (in-person payments) integrations must pass payment_method_types: ['card_present'] on the PaymentIntent. For all other integrations, omit this parameter entirely to enable dynamic payment methods, which enables you to configure payment method settings from the Dashboard and dynamically display the most relevant eligible payment methods to each customer to maximize conversion. To customize which payment methods you accept, use payment_method_configurations or excluded_payment_method_types instead of payment_method_types.

  • When a PaymentIntent or SetupIntent integration requires an explicit allowlist, use allowed_payment_method_types instead of payment_method_types.

  • Never present webhooks as optional. We recommend webhooks for every payment integration and they’re required for subscriptions and asynchronous payment methods. Fulfillment belongs in a handler for both checkout.session.completed and checkout.session.async_payment_succeeded (gated on payment_status), not the success page. See references/payments.md.

  • On API version 2026-03-25.dahlia or later, pass the parameter integration_identifier to checkout.sessions.create to tag sessions with a custom label for tracking and comparing checkout flows in the Dashboard. The label should include a suffix of 8 random letters.

  • Always instantiate a StripeClient and call methods on that instance. Do not use the deprecated global/module-level API key pattern (stripe.api_key = …, Stripe.setApiKey, stripe.Key = …, StripeConfiguration.ApiKey = …). The global pattern is deprecated in all current SDKs.

Key documentation

When the user’s request does not clearly fit a single domain above, consult:

来源与署名

来源:stripe/ai位于providers/claude/plugin/skills/stripe-best-practices提交97b2164

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架