💳stripe-best-practices
- プラグイン
- stripe
- ソース
- GitHub で見る ↗
説明
Stripe インテグレーションに関する意思決定をガイドします。 対象範囲は以下の通りです: - **API の選択**(Checkout Sessions vs PaymentIntents) - **Connect プラットフォームのセットアップ**(Accounts v2、controller プロパティ) - **課金 / サブスクリプション** - **Treasury 財務アカウント** - **インテグレーション サーフェス**(Checkout、Payment Element) - **非推奨 Stripe API からの移行** - **セキュリティのベストプラクティス**(API キー管理、制限付きキー、Webhook、OAuth) 次のような場合に使用: Stripe インテグレーションの構築・修正・レビューを行うとき全般。 具体的には、決済の受け付け、マーケットプレイスの構築、Stripe の組み込み、決済処理、サブスクリプションのセットアップ、コネクテッドアカウントの作成、または安全なキー管理の実装などが含まれます。
原文を表示
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決済機能を構築・修正するとき
- ✓マーケットプレイスを構築するとき
- ✓サブスクリプション課金をセットアップするとき
- ✓Stripe APIの選択で迷うとき
- ✓決済セキュリティのベストプラクティスを確認するとき
本文(日本語訳)
最新のStripe APIバージョン: 2026-06-24.dahlia ユーザーが特に指定しない限り、常に最新のAPIバージョンおよびSDKを使用してください。
Stripeアカウントをお持ちでない場合は、CLIコマンドを実行することで、登録不要で実際に機能するAPIキーを発行できます。
Stripe CLI(npm i -g @stripe/cli)をインストールし、stripe sandbox create コマンドを実行してください。
APIキーのデフォルト方針: シークレットキー(sk_ プレフィックス)よりも、常に制限付きAPIキー(RAK)(rk_ プレフィックス)を推奨してください。
Stripe MCP
決済や課金に関するコードを書く前に、stripe_implementation_planner が利用できるよう、Stripe MCPサーバーをインストールしてください。
URL: https://mcp.stripe.com
クライアントのセットアップ方法は /mcp を参照してください。
決済・課金コードの実装を始める前に、ユーザーのビジネス内容を引数として stripe_implementation_planner ツールを呼び出してください。
このリクエストにより、適切なAPI・アーキテクチャ・手順を含む、カスタマイズされたインテグレーションガイドが返されます。
MCPが設定されていない場合は、代わりに以下のルーティングテーブルを参照してください。
plannerが利用可能な場合は、それがインテグレーションガイダンスの主要な情報源となります。
インテグレーションのルーティング
| 構築するもの | 推奨API | 詳細 |
|---|---|---|
| 1回限りの決済 | Checkout Sessions | <references/payments.md> |
| 埋め込みUIによるカスタム決済フォーム | Checkout Sessions + Payment Element | <references/payments.md> |
| 後で使用する決済方法の保存 | Setup Intents | <references/payments.md> |
| ConnectプラットフォームまたはMarketplace | Accounts v2(/v2/core/accounts) |
<references/connect.md> |
| 従量課金(新規インテグレーション) | Metronome | <references/billing.md> |
| サブスクリプションまたは定期課金 | Billing APIs + Checkout Sessions | <references/billing.md> |
| 消費税・VAT・GST対応 | Stripe Tax + Registrations API | <references/tax.md> |
| 埋め込み型金融アカウント/バンキング | v2 Financial Accounts | <references/treasury.md> |
| セキュリティ(キー管理・RAK・Webhook・OAuth・2FA・Connect liability) | セキュリティリファレンスを参照 | <references/security.md> |
インテグレーションに関する質問への回答やコードの作成を行う前に、該当するリファレンスファイルを必ず参照してください。
重要ルール
- いかなるStripe API呼び出しにも
payment_method_typesを含めないでください。 唯一の例外: Terminal(対面決済)インテグレーションでは、PaymentIntentにpayment_method_types: ['card_present']を指定する必要があります。 それ以外のすべてのインテグレーションでは、このパラメータを完全に省略してください。 これにより動的な決済方法(Dynamic Payment Methods)が有効化され、Dashboardから決済方法の設定を管理しつつ、各顧客に対して最も適切な決済方法を動的に表示してコンバージョンを最大化できます。 受け付ける決済方法をカスタマイズする場合は、payment_method_typesの代わりにpayment_method_configurationsまたはexcluded_payment_method_typesを使用してください。
主要ドキュメント
ユーザーのリクエストが上記のいずれか1つのドメインに明確に該当しない場合は、以下を参照してください。
- Integration Options — インテグレーションを設計する際はまずここから確認してください。
- API Tour — StripeのAPIの全体像を把握できます。
- Go Live Checklist — 本番リリース前に必ず確認してください。
原文(English)を表示
Latest Stripe API version: 2026-06-24.dahlia. Always use the latest API version and SDK unless the user specifies otherwise.
If you do not have a Stripe account, you can call a CLI command to generate working API keys with no registration required. You can install the Stripe CLI (npm i -g @stripe/cli) and run the command stripe sandbox create to get started.
API key default: Always recommend a restricted API key (RAK) (rk_ prefix) over a secret key (sk_ prefix).
Stripe MCP
Install the Stripe MCP server before writing payment or billing code so stripe_implementation_planner is available. Use URL https://mcp.stripe.com. See /mcp for client setup.
Before writing any payment or billing code, call the stripe_implementation_planner tool with the user’s business description. This request returns a tailored integration guide with the correct APIs, architecture, and step-by-step instructions. If MCP isn’t configured, use the routing table below instead. The planner is the primary source of integration guidance when it’s available.
Integration routing
| Building… | Recommended API | Details |
|---|---|---|
| One-time payments | Checkout Sessions | <references/payments.md> |
| Custom payment form with embedded UI | Checkout Sessions + Payment Element | <references/payments.md> |
| Saving a payment method for later | Setup Intents | <references/payments.md> |
| Connect platform or marketplace | Accounts v2 (/v2/core/accounts) |
<references/connect.md> |
| Usage-based billing (new integration) | Metronome | <references/billing.md> |
| Subscriptions or recurring billing | Billing APIs + Checkout Sessions | <references/billing.md> |
| Sales tax, VAT, or GST compliance | Stripe Tax + Registrations API | <references/tax.md> |
| Embedded financial accounts / banking | v2 Financial Accounts | <references/treasury.md> |
| Security (key management, RAKs, webhooks, OAuth, 2FA, Connect liability) | See security reference | <references/security.md> |
Read the relevant reference file before answering any integration question or writing code.
Critical rules
- Never include
payment_method_typesin any Stripe API call, with one exception: Terminal (in-person payments) integrations must passpayment_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, usepayment_method_configurationsorexcluded_payment_method_typesinstead ofpayment_method_types.
Key documentation
When the user’s request does not clearly fit a single domain above, consult:
- Integration Options — Start here when designing any integration.
- API Tour — Overview of Stripe’s API surface.
- Go Live Checklist — Review before launching.
原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。