# 高度な決済連携機能を構築する Stripe Elements と Checkout Sessions API または Payment Intents API を使用してカスタム決済連携を作成する方法をご紹介します。 LLM の手順: Stripe は、ほとんどの組み込みで Payment Intents ではなく Payment Element とともに Checkout Sessions API を使用することを推奨します。Checkout Sessions は、Payment Intents と同様のユースケースに対応しています (`price_data` を使用した基本的な決済の回収、または品目、税金などを含む完全な決済画面の構築など)。Adaptive Pricing などの一部の機能は、Checkout Sessions でのみ利用できます。ユーザーが明示的に要求しない限り、Payment Intents API は使用しないでください。必要となるコード量が大幅に多くなるためです。Checkout Sessions API と Elements の詳細については次を参照してください。https://docs.stripe.com/payments/quickstart-checkout-sessions. Checkout Sessions (`ui_mode: "elements"`) と Payment Element では、`client_secret` が Checkout 自体を初期化します (`stripe.initCheckoutElementsSdk`、または React で CheckoutElementsProvider を使用)。そのうえで、クライアント側での決済の確定方法が異なります。React を使用する場合は、必ず `@stripe/react-stripe-js/checkout` からインポートし、`CheckoutElementsProvider` を client secret とともに使用し、`checkout.confirm` を使用して決済を確定します。HTML を使用する場合は、必ず `checkout = stripe.initCheckoutElementsSdk({clientSecret: promise}); checkout.createPaymentElement(); paymentElement = checkout.createPaymentElement(); paymentElement.mount("#payment-element");` を使用し、`loadActionsResult = await checkout.loadActions(); actions = loadActionsResult.actions; error = await actions.confirm();` で決済を確定します。 [Stripe Elements](https://docs.stripe.com/payments/elements.md) のユーザーインターフェイスを [Checkout Sessions API](https://docs.stripe.com/api/checkout/sessions.md) とともに使用して、カスタマイズされた決済の組み込みを作成します。Checkout Sessions はほとんどの組み込みに推奨される API であり、Payment Intents と同様のユースケースに対応します。[Payment Intents API](https://docs.stripe.com/api/payment_intents.md) は、独自の決済フローの構築にも使用できます。ビジネスに適した API を理解するには、[Checkout Sessions API と Payment Intents API を比較](https://docs.stripe.com/payments/checkout-sessions-and-payment-intents-comparison.md)してください。 ## 完全な UI 制御によるカスタム連携の構築 [Stripe Elements](https://docs.stripe.com/payments/elements.md) を使用して、決済を受け付ける独自のカスタム連携の構築を開始してください。 [決済システムの構築を開始](https://docs.stripe.com/payments/quickstart-checkout-sessions.md) ## 機能と提供状況 |   | [**Checkout Sessions API**](https://docs.stripe.com/payments/accept-a-payment.md?payment-ui=elements&api-integration=checkout) | [**Payment Intents API**](https://docs.stripe.com/payments/accept-a-payment.md?payment-ui=elements&api-integration=paymentintents) | | -------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------- | | **UI** | [Elements](https://docs.stripe.com/payments/elements.md) | [Elements](https://docs.stripe.com/payments/elements.md) | | **API** | [Checkout Sessions](https://docs.stripe.com/api/checkout/sessions.md) | [PaymentIntents](https://docs.stripe.com/payments/payment-intents.md) | | **導入作業** | ローコード | 最もコーディングが多い ─ 決済機能を自社で構築 | | **ホスティング** | サイトに組み込む | サイトに組み込む | | **UI のカスタマイズ** | [Appearance API](https://docs.stripe.com/elements/appearance-api.md) による広範なカスタマイズ | [Appearance API](https://docs.stripe.com/elements/appearance-api.md) による広範なカスタマイズ | | **決済手段**1 | | 40 種類以上の決済手段を [動的に表示](https://docs.stripe.com/payments/payment-methods/dynamic-payment-methods.md) | ✓ Supported | ✓ Supported | | コーディングなしで [Stripe ダッシュボード](https://dashboard.stripe.com/settings/payment_methods) で決済手段を管理 | ✓ Supported | ✓ Supported | | **[Link による決済の高速化](https://docs.stripe.com/payments/link.md)** | ✓ Supported | ✓ Supported | | **[カスタム決済手段](https://docs.stripe.com/payments/payment-methods/custom-payment-methods.md)** | - Unsupported | ✓ Supported | 1各決済手段に対応する詳細については、[決済手段の詳細をご覧ください](https://docs.stripe.com/payments/payment-methods/overview.md)。 ### 決済シナリオサポートの比較 導入パスごとに異なる決済シナリオに Stripe がどのように対応しているかを参照してください。 |   | [**Checkout Sessions API**](https://docs.stripe.com/payments/accept-a-payment.md?payment-ui=elements&api-integration=checkout) | [**Payment Intents API**](https://docs.stripe.com/payments/accept-a-payment.md?payment-ui=elements&api-integration=paymentintents) | | ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------- | | [将来の決済を設定する](https://docs.stripe.com/payments/save-and-reuse.md) | ✓ Supported | ✓ Supported | | [決済時に決済の詳細を保存する](https://docs.stripe.com/payments/save-and-reuse.md) | ✓ Supported | ✓ Supported | | [決済手段をホールドする](https://docs.stripe.com/payments/place-a-hold-on-a-payment-method.md) | ✓ Supported | ✓ Supported | | [サーバーで決済を確定する](https://docs.stripe.com/payments/finalize-payments-on-the-server.md) | ✓ Supported | ✓ Supported | | [マルチステップ決済フロー](https://docs.stripe.com/payments/build-a-two-step-confirmation.md) | - Unsupported | ✓ Supported | | [柔軟な決済シナリオ](https://docs.stripe.com/payments/flexible-payments.md)1 | | [マルチキャプチャ](https://docs.stripe.com/payments/multicapture.md) | ✓ Supported | ✓ Supported | | [オーバーキャプチャ](https://docs.stripe.com/payments/overcapture.md) | ✓ Supported | ✓ Supported | | [オーソリの拡張](https://docs.stripe.com/payments/extended-authorization.md) | ✓ Supported | ✓ Supported | | [増分オーソリ](https://docs.stripe.com/payments/incremental-authorization.md) | ✓ Supported | ✓ Supported | 1 [IC+ 料金体系](https://support.stripe.com/questions/understanding-blended-interchange-pricing) でのみ利用できます。 ## 決済のカスタマイズ [デザインをカスタマイズする](https://docs.stripe.com/elements/appearance-api.md): 決済ページのデザインと動作をカスタマイズします。 [決済手段を管理する](https://docs.stripe.com/payments/advanced/payment-methods/manage.md): 顧客ごとおよび地域ごとに、最適な決済手段を提示します。 [ワンクリック決済オプション](https://docs.stripe.com/elements/express-checkout-element.md): 1 つのコンポーネントで複数のワンクリック決済ボタンを表示します。 [メール領収書を送信する](https://docs.stripe.com/payments/advanced/receipts.md): 支払いまたは返金の領収書を自動送信します。 ## 複数の支払い情報を収集する [追加情報を収集する](https://docs.stripe.com/payments/advanced/collect-additional-info.md): 決済フロー中に配送やその他の顧客情報を収集します。 [税金を徴収する](https://docs.stripe.com/tax/standalone-tax-api.md): Stripe Tax API を使用して、カスタム連携で税金計算を実装します。 [柔軟な支払いシナリオ](https://docs.stripe.com/payments/flexible-payments.md): 柔軟でカスタマイズ可能なアクワイアリング機能によって、複雑な決済フローをサポートします。 ## 支払いの回収タイミングを選択する [サブスクリプション](https://docs.stripe.com/billing/subscriptions/build-subscriptions.md?payment-ui=elements): 継続支払いを受け付けるサブスクリプションを作成して管理します。 [将来の支払いを設定する](https://docs.stripe.com/payments/save-and-reuse.md?platform=web&ui=elements): 支払い情報を保存し、後日に顧客に請求します。 [決済フロー中に支払い情報を保存する](https://docs.stripe.com/payments/save-during-payment.md?platform=web&ui=elements): 決済フロー中に支払い情報を保存します。