# iDEAL | Wero を使用して将来の SEPA ダイレクトデビット決済を設定する iDEAL | Wero での決済から銀行口座の詳細を保存し、後から SEPA ダイレクトデビットで顧客に請求する方法をご紹介します。 支払いを受け付けて IBAN 詳細を保存する必要がある場合は、[支払い時に銀行情報を保存する](https://docs.stripe.com/payments/ideal/save-during-payment.md)をご覧ください。 > [支払いの事前設定](https://docs.stripe.com/payments/save-and-reuse.md)ガイドに従うことをお勧めします。すでに Elements との連携が完了している場合は、[Payment Element 移行ガイド](https://docs.stripe.com/payments/payment-element/migration.md)をご覧ください。 iDEAL | Wero (旧 iDEAL) は、顧客が決済ごとに[認証する](https://docs.stripe.com/payments/payment-methods.md#customer-actions)必要がある[1 回限り](https://docs.stripe.com/payments/payment-methods.md#usage)の決済手段です。この組み込みにより、Stripe は iDEAL | Wero を通じて顧客に 0.01 EUR を請求し、銀行口座の詳細を収集します。顧客が決済を認証すると、Stripe は決済を返金し、顧客の [IBAN](https://en.wikipedia.org/wiki/International_Bank_Account_Number) を [SEPA ダイレクトデビット](https://docs.stripe.com/payments/sepa-debit.md)決済手段に保存します。その後、SEPA ダイレクトデビット [PaymentMethod](https://docs.stripe.com/api/payment_methods.md) を使用して、[決済を受け付ける](https://docs.stripe.com/payments/sepa-debit/accept-a-payment.md)か、[サブスクリプションを設定](https://docs.stripe.com/billing/subscriptions/sepa-debit.md)することができます。 iDEAL | Wero を使用して SEPA ダイレクトデビット決済を設定するには、[ダッシュボード](https://dashboard.stripe.com/account/payments/settings)で SEPA ダイレクトデビットを有効にする必要があります。また、[iDEAL 利用規約](https://stripe.com/ideal/legal)と [SEPA ダイレクトデビット利用規約](https://stripe.com/sepa-direct-debit/legal)に準拠する必要があります。 # Checkout > This is a Checkout for when payment-ui is checkout. View the full page at https://docs.stripe.com/payments/ideal/set-up-payment?payment-ui=checkout. [Checkout の設定モード](https://docs.stripe.com/payments/save-and-reuse.md?platform=checkout)を使用すると、決済の詳細を収集し、iDEAL | Wero を使用して将来の SEPA ダイレクトデビット決済を設定できます。 ## 顧客を作成または取得する [サーバー側] iDEAL | Wero を使用して将来の SEPA ダイレクトデビット決済を設定するには、SEPA ダイレクトデビットの決済手段を顧客を表すオブジェクトに紐付ける必要があります。 > #### Accounts v2 API を使用した顧客の表現 > > Accounts v2 API では、Connect ユーザーには一般提供され、その他の Stripe ユーザーには公開プレビューで提供されます。Accounts v2 プレビューの一部である場合は、コードで[プレビューバージョン](https://docs.stripe.com/api-v2-overview.md#sdk-and-api-versioning)を指定する必要があります。 > > Accounts v2 プレビューへのアクセスをリクエストするには、 > > ほとんどのユースケースでは、[Customer](https://docs.stripe.com/api/customers.md) オブジェクトを使用するのではなく、[顧客を顧客設定済みの Account オブジェクトとしてモデル化する](https://docs.stripe.com/accounts-v2/use-accounts-as-customers.md)ことをお勧めします。 顧客がビジネスでアカウントを作成するとき、または決済手段を保存するときに、顧客設定の [Account](https://docs.stripe.com/api/v2/core/accounts/create.md#v2_create_accounts-configuration-customer) または [Customer](https://docs.stripe.com/api/customers/create.md) を作成する。オブジェクトの ID を、顧客を表す独自の内部表現に関連付ける。 この決済に関連付ける新しい顧客を作成するか、既存の顧客を取得する。 #### Accounts v2 ```curl curl -X POST https://api.stripe.com/v2/core/accounts \ -H "Authorization: Bearer <>" \ -H "Stripe-Version: 2026-04-22.preview" \ --json '{ "contact_email": "jenny.rosen@example.com", "display_name": "Jenny Rosen", "configuration": { "customer": {} }, "include": [ "configuration.customer" ] }' ``` #### Customers v1 ```curl curl https://api.stripe.com/v1/customers \ -u "<>:" \ -d "name=Jenny Rosen" \ --data-urlencode "email=jenny.rosen@example.com" ``` ## 支払いの事前設定 このガイドは、[将来の決済](https://docs.stripe.com/payments/save-and-reuse.md?platform=checkout) 決済導入の基本的な設定に基づいて構築されており、[動的支払い方法](https://docs.stripe.com/payments/payment-methods/dynamic-payment-methods.md) を使用する場合と支払い方法を手動で設定する場合の違いを示します。 ### 決済手段として iDEAL | Wero を有効にする 新しい [Checkout セッション](https://docs.stripe.com/api/checkout/sessions.md)を作成する際に、`ideal` を `payment_method_types` のリストに追加する必要があります。 #### Stripe ホスト型ページ #### Accounts v2 ```curl curl https://api.stripe.com/v1/checkout/sessions \ -u "<>:" \ -d "customer_account={{CUSTOMERACCOUNT_ID}}" \ -d mode=setup \ -d "payment_method_types[]=card" \ -d "payment_method_types[]=ideal" \ --data-urlencode "success_url=https://example.com/success" ``` #### Customers v1 ```curl curl https://api.stripe.com/v1/checkout/sessions \ -u "<>:" \ -d "customer={{CUSTOMER_ID}}" \ -d mode=setup \ -d "payment_method_types[]=card" \ -d "payment_method_types[]=ideal" \ --data-urlencode "success_url=https://example.com/success" ``` #### 完全埋め込みページ #### Accounts v2 ```curl curl https://api.stripe.com/v1/checkout/sessions \ -u "<>:" \ -d "customer_account={{CUSTOMERACCOUNT_ID}}" \ -d mode=setup \ -d "payment_method_types[]=card" \ -d "payment_method_types[]=ideal" \ --data-urlencode "return_url=https://example.com/return" \ -d ui_mode=embedded_page ``` #### Customers v1 ```curl curl https://api.stripe.com/v1/checkout/sessions \ -u "<>:" \ -d "customer={{CUSTOMER_ID}}" \ -d mode=setup \ -d "payment_method_types[]=card" \ -d "payment_method_types[]=ideal" \ --data-urlencode "return_url=https://example.com/return" \ -d ui_mode=embedded_page ``` ## 後日 SEPA ダイレクトデビット PaymentMethod に請求する [サーバー側] 顧客に再度請求する必要が生じたときは、新しい PaymentIntent を作成します。SetupIntent を[取得](https://docs.stripe.com/api/setup_intents/retrieve.md)し、`latest_attempt` フィールドを[展開](https://docs.stripe.com/api/expanding_objects.md)して `payment_method_details` 内の `generated_sepa_debit` ID を探すことで、SEPA ダイレクトデビットの決済手段の ID を見つけます。 ```curl curl -G https://api.stripe.com/v1/setup_intents/{{SETUP_INTENT_ID}} \ -u "<>:" \ -d "expand[]=latest_attempt" ``` SEPA ダイレクトデビット ID と顧客の ID を使用して、`PaymentIntent` を作成します。 #### Accounts v2 ```curl curl https://api.stripe.com/v1/payment_intents \ -u "<>:" \ -d "payment_method_types[]=sepa_debit" \ -d amount=1099 \ -d currency=eur \ -d "customer_account={{CUSTOMERACCOUNT_ID}}" \ -d payment_method={{SEPA_DEBIT_PAYMENT_METHOD_ID}} \ -d confirm=true ``` #### Customers v1 ```curl curl https://api.stripe.com/v1/payment_intents \ -u "<>:" \ -d "payment_method_types[]=sepa_debit" \ -d amount=1099 \ -d currency=eur \ -d "customer={{CUSTOMER_ID}}" \ -d payment_method={{SEPA_DEBIT_PAYMENT_METHOD_ID}} \ -d confirm=true ``` ## 組み込みをテストする [テスト用 API キー](https://docs.stripe.com/keys.md#test-live-modes)を使用し、リストから任意の銀行を選択します。確定すると、決済手段を承認または失敗させるオプションが設定されているテストページにリダイレクトされます。 - **Authorize test payment (テスト支払いをオーソリする)** をクリックして、設定成功のケースをテストします。 - **Fail test payment (テスト支払いを失敗させる)** をクリックして、顧客が認証に失敗するケースをテストします。 # Elements > This is a Elements for when payment-ui is elements. View the full page at https://docs.stripe.com/payments/ideal/set-up-payment?payment-ui=elements. アプリで iDEAL | Wero を使用した将来の SEPA ダイレクトデビット決済の設定は、プロセスを追跡する [SetupIntent](https://docs.stripe.com/api/setup_intents.md) オブジェクトの作成、同意書承認の収集、そして iDEAL | Wero への顧客のリダイレクトで構成されます。Stripe はこの SetupIntent を使用して、設定が完了するまで、設定のすべての状態を追跡および処理します。 ## Stripe を設定する [サーバー側] まず、Stripe アカウントが必要です。[今すぐご登録ください](https://dashboard.stripe.com/register)。 アプリケーションから Stripe API にアクセスするには、Stripe の公式ライブラリを使用します。 #### Ruby ```bash # Available as a gem sudo gem install stripe ``` ```ruby # If you use bundler, you can add this line to your Gemfile gem 'stripe' ``` ## 顧客を作成または取得する [サーバー側] > #### Accounts v2 API を使用した顧客の表現 > > Accounts v2 API では、Connect ユーザーには一般提供され、その他の Stripe ユーザーには公開プレビューで提供されます。Accounts v2 プレビューの一部である場合は、コードで[プレビューバージョン](https://docs.stripe.com/api-v2-overview.md#sdk-and-api-versioning)を指定する必要があります。 > > Accounts v2 プレビューへのアクセスをリクエストするには、 > > ほとんどのユースケースでは、[Customer](https://docs.stripe.com/api/customers.md) オブジェクトを使用するのではなく、[顧客を顧客設定済みの Account オブジェクトとしてモデル化する](https://docs.stripe.com/accounts-v2/use-accounts-as-customers.md)ことをお勧めします。 顧客がビジネスでアカウントを作成するとき、または決済手段を保存するときに、顧客設定の [Account](https://docs.stripe.com/api/v2/core/accounts/create.md#v2_create_accounts-configuration-customer) または [Customer](https://docs.stripe.com/api/customers/create.md) を作成する。オブジェクトの ID を、顧客を表す独自の内部表現に関連付ける。 この決済に関連付ける新しい顧客を作成するか、既存の顧客を取得する。 #### Accounts v2 ```curl curl -X POST https://api.stripe.com/v2/core/accounts \ -H "Authorization: Bearer <>" \ -H "Stripe-Version: 2026-04-22.preview" \ --json '{ "contact_email": "jenny.rosen@example.com", "display_name": "Jenny Rosen", "configuration": { "customer": {} }, "include": [ "configuration.customer" ] }' ``` #### Customers v1 ```curl curl https://api.stripe.com/v1/customers \ -u "<>:" \ -d "name=Jenny Rosen" \ --data-urlencode "email=jenny.rosen@example.com" ``` ## SetupIntent を作成する [サーバー側] 顧客の ID を使用して `SetupIntent` を作成し、`ideal` を [payment_method_types](https://docs.stripe.com/api/setup_intents/create.md#create_setup_intent-payment_method_types) 配列に追加します。`SetupIntent` はセットアッププロセスの手順を追跡します。iDEAL | Wero の場合、これには顧客から [SEPA ダイレクトデビットの同意書](https://www.europeanpaymentscouncil.eu/what-we-do/sepa-direct-debit/sdd-mandate) を取得し、その有効性を追跡することが含まれます。 #### Accounts v2 ```curl curl https://api.stripe.com/v1/setup_intents \ -u "<>:" \ -d "payment_method_types[]=ideal" \ -d "customer_account={{CUSTOMERACCOUNT_ID}}" ``` #### Customers v1 ```curl curl https://api.stripe.com/v1/setup_intents \ -u "<>:" \ -d "payment_method_types[]=ideal" \ -d customer={{CUSTOMER_ID}} ``` ## 支払い方法の詳細を収集する [クライアント側] [Payment Element](https://docs.stripe.com/payments/payment-element.md) を使用してクライアント側で支払い詳細を収集します。Payment Element は事前構築された UI コンポーネントであり、さまざまな決済手段の詳細の収集をシンプルにします。 Payment Element には、HTTPS 接続を介して支払い情報を Stripe に安全に送信する iframe が含まれています。一部の支払い方法では、支払いを確定するために別のページにリダイレクトする必要があるため、Payment Element を別の iframe 内に配置しないでください。 iframe を使用して Apple Pay または Google Pay を受け付けたい場合は、iframe の [allow](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-allowpaymentrequest) 属性を `"payment *"` と等しく設定する必要があります。 構築済みのシステムを機能させるには、決済ページのアドレスの先頭を `http://` ではなく `https://` にする必要があります。HTTPS を使用しなくてもシステムをテストできますが、本番環境で決済を受け付ける準備が整ったら、必ず、HTTPS を[有効](https://docs.stripe.com/security/guide.md#tls)にしてください。 #### HTML + JS ### Stripe.js を設定する Payment Element は Stripe.js の機能として自動的に使用できるようになります。決済ページに Stripe.js スクリプトを含めるには、HTML ファイルの `head` にスクリプトを追加します。常に js.stripe.com から Stripe.js を直接読み込むことにより、PCI 準拠が維持されます。スクリプトをバンドルに含めたり、そのコピーを自身でホストしたりしないでください。 ```html Checkout ``` 決済ページで以下の JavaScript を使用して、Stripe のインスタンスを作成します。 ```javascript // Set your publishable key: remember to change this to your live publishable key in production // See your keys here: https://dashboard.stripe.com/apikeys const stripe = Stripe('<>'); ``` ### Payment Element を支払いページに追加する Payment Element を決済ページに配置する場所が必要です。決済フォームで、一意の ID を持つ空の DOM ノード (コンテナー) を作成します。 ```html
``` 前のフォームが読み込まれたら、Payment Element のインスタンスを作成して、それをコンテナーの DOM ノードにマウントします。[Elements](https://docs.stripe.com/js/elements_object/create) インスタンスを作成する際に、前のステップからの [client secret](https://docs.stripe.com/api/setup_intents/object.md#setup_intent_object-client_secret) を `options` に渡します。 ```javascript const options = { clientSecret: '{{CLIENT_SECRET}}', // Fully customizable with appearance API. appearance: {/*...*/}, }; // Set up Stripe.js and Elements to use in checkout form, passing the client secret obtained in a previous stepconst elements = stripe.elements(options); // Optional: Autofill user's saved payment methods. If the customer's // email is known when the page is loaded, you can pass the email // to the linkAuthenticationElement on mount: // // linkAuthenticationElement.mount("#link-authentication-element", { // defaultValues: { // email: 'jenny.rosen@example.com', // } // }) // Create and mount the Payment Element const paymentElementOptions = { layout: 'accordion'}; const paymentElement = elements.create('payment', paymentElementOptions); paymentElement.mount('#payment-element'); ``` #### React ### Stripe.js を設定する 次の npm パブリックレジストリーから [React Stripe.js](https://www.npmjs.com/package/@stripe/react-stripe-js) と [Stripe.js ローダー](https://www.npmjs.com/package/@stripe/stripe-js)をインストールします。 ```bash npm install --save @stripe/react-stripe-js @stripe/stripe-js ``` ### Elements プロバイダーを支払いページに追加して設定する Payment Element コンポーネントを使用するには、決済ページコンポーネントを [Elements プロバイダー](https://docs.stripe.com/sdks/stripejs-react.md#elements-provider)でラップします。公開キーを使用して `loadStripe` を呼び出し、返された `Promise` を `Elements` プロバイダーに渡します。加えて、前のステップの [client secret](https://docs.stripe.com/api/payment_intents/object.md#payment_intent_object-client_secret) を `options` にして `Elements` プロバイダーに渡します。 ```jsx import React from 'react'; import ReactDOM from 'react-dom'; import {Elements} from '@stripe/react-stripe-js'; import {loadStripe} from '@stripe/stripe-js'; import SetupForm from './SetupForm'; // Make sure to call `loadStripe` outside of a component’s render to avoid // recreating the `Stripe` object on every render. const stripePromise = loadStripe('<>'); function App() { const options = { // passing the client secret obtained in step 3 clientSecret: '{{CLIENT_SECRET}}', // Fully customizable with appearance API. appearance: {/*...*/}, }; return ( ); }; ReactDOM.render(, document.getElementById('root')); ``` ### Payment Element コンポーネントを追加する `PaymentElement` コンポーネントを使用して、フォームを構築します。 ```jsx import React from 'react'; import {PaymentElement} from '@stripe/react-stripe-js'; const SetupForm = () => { return (
); }; export default SetupForm; ``` ## Stripe に支払い方法の詳細を送信する [クライアント側] `SetupIntent` オブジェクト全体をクライアントに送信する代わりに、その [client secret](https://docs.stripe.com/api/setup_intents/object.md#setup_intent_object-client_secret) を使用してください。これは、Stripe API リクエストを認証する API キーとは異なります。セットアップを完了できるため、client secret は慎重に取り扱ってください。ログに記録したり、URL に埋め込んだり、顧客以外に公開したりしないでください。 [stripe.confirmSetup](https://docs.stripe.com/js/payment_intents/confirm_setup) を使用し、Payment Element の詳細を参照して設定インテントを完了します。この関数に [return_url](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-return_url) を指定して、設定インテントを完了した後に Stripe がユーザーをリダイレクトする場所を指示します。ユーザーは、`return_url` にリダイレクトされる前に、まず銀行の認証ページなどの中間サイトにリダイレクトされる場合があります。 #### HTML + JS ```javascript const form = document.getElementById('payment-form'); form.addEventListener('submit', async (event) => { event.preventDefault(); const {error} = await stripe.confirmSetup({ //`Elements` instance that was used to create the Payment Element elements, confirmParams: { return_url: 'https://example.com/order/123/complete', }, }); if (error) { // This point will only be reached if there is an immediate error when // confirming the setup intent. Show error to your customer (for example, payment // details incomplete) const messageContainer = document.querySelector('#error-message'); messageContainer.textContent = error.message; } else { // Your customer will be redirected to your `return_url`. For some payment // methods like iDEAL | Wero, your customer will be redirected to an intermediate // site first to authorize the payment, then redirected to the `return_url`. } }); ``` #### React 支払いフォームコンポーネントから [stripe.confirmSetup](https://docs.stripe.com/js/setup_intents/confirm_setup) を呼び出すには、[useStripe](https://docs.stripe.com/sdks/stripejs-react.md#usestripe-hook) フックと [useElements](https://docs.stripe.com/sdks/stripejs-react.md#useelements-hook) フックを使用します。 フックではなく従来のクラスコンポーネントを使用する場合は、代わりに [ElementsConsumer](https://docs.stripe.com/sdks/stripejs-react.md#elements-consumer) を使用します。 ```jsx import React, {useState} from 'react'; import {useStripe, useElements, PaymentElement} from '@stripe/react-stripe-js'; const CheckoutForm = () => { const stripe = useStripe(); const elements = useElements(); const [errorMessage, setErrorMessage] = useState(null); const handleSubmit = async (event) => { // We don't want to let default form submission happen here, // which would refresh the page. event.preventDefault(); if (!stripe || !elements) { // Stripe.js hasn't yet loaded. // Make sure to disable form submission until Stripe.js has loaded. return; } const {error} = await stripe.confirmSetup({ //`Elements` instance that was used to create the Payment Element elements, confirmParams: { return_url: 'https://example.com/order/123/complete', }, }); if (error) { // This point will only be reached if there is an immediate error when // confirming the payment. Show error to your customer (for example, payment // details incomplete) setErrorMessage(error.message); } else { // Your customer will be redirected to your `return_url`. For some payment // methods like iDEAL | Wero, your customer will be redirected to an intermediate // site first to authorize the payment, then redirected to the `return_url`. } }; return (
{/* Show error message to your customers */} {errorMessage &&
{errorMessage}
} ) }; export default CheckoutForm; ``` `return_url` が、設定インテントのステータスを表示するウェブサイトのページに対応していることを確認します。Stripe が顧客を `return_url` にリダイレクトするときに、次の URL クエリパラメーターが提供されます。 | パラメーター | 説明 | | ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | | `setup_intent` | `SetupIntent` の一意の識別子。 | | `setup_intent_client_secret` | `SetupIntent` オブジェクトの [client secret](https://docs.stripe.com/api/setup_intents/object.md#setup_intent_object-client_secret)。 | ## 後日 SEPA ダイレクトデビット PaymentMethod に請求する [サーバー側] 顧客に再度請求する必要が生じたときは、新しい PaymentIntent を作成します。SetupIntent を[取得](https://docs.stripe.com/api/setup_intents/retrieve.md)し、`latest_attempt` フィールドを[展開](https://docs.stripe.com/api/expanding_objects.md)して `payment_method_details` 内の `generated_sepa_debit` ID を探すことで、SEPA ダイレクトデビットの決済手段の ID を見つけます。 ```curl curl -G https://api.stripe.com/v1/setup_intents/{{SETUP_INTENT_ID}} \ -u "<>:" \ -d "expand[]=latest_attempt" ``` SEPA ダイレクトデビット ID と顧客の ID を使用して、`PaymentIntent` を作成します。 #### Accounts v2 ```curl curl https://api.stripe.com/v1/payment_intents \ -u "<>:" \ -d "payment_method_types[]=sepa_debit" \ -d amount=1099 \ -d currency=eur \ -d "customer_account={{CUSTOMERACCOUNT_ID}}" \ -d payment_method={{SEPA_DEBIT_PAYMENT_METHOD_ID}} \ -d confirm=true ``` #### Customers v1 ```curl curl https://api.stripe.com/v1/payment_intents \ -u "<>:" \ -d "payment_method_types[]=sepa_debit" \ -d amount=1099 \ -d currency=eur \ -d "customer={{CUSTOMER_ID}}" \ -d payment_method={{SEPA_DEBIT_PAYMENT_METHOD_ID}} \ -d confirm=true ``` ## 導入をテストする [テスト API キー](https://docs.stripe.com/keys.md#test-live-modes)を使用して SetupIntent を確定します。確定すると、決済手段の設定を承認または失敗させるオプションのあるテストページにリダイレクトされます。 - **Authorize test payment (テスト支払いをオーソリする)** をクリックして、設定成功のケースをテストします。SetupIntent が `requires_action` から `succeeded` に変わります。 - **Fail test payment (テスト支払いを失敗させる)** をクリックして、顧客が認証に失敗するケースをテストします。SetupIntent が `requires_action` から `requires_payment_method` に変わります。 ### SEPA ダイレクトデビット組み込みのテスト #### メール `payment_method.billing_details.email` を以下のいずれかの値に設定して、`PaymentIntent` のステータス遷移をテストしてください。任意のテキストとアンダースコアをメールアドレスの前に追加することもできます。例えば、`test_1_generatedSepaDebitIntentsFail@example.com` を使用すると、`PaymentIntent` で使用した際に必ず失敗する SEPA ダイレクトデビットの PaymentMethodになります。 | メールアドレス | 説明 | | ------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------- | | `generatedSepaDebitIntentsSucceed@example.com` | `PaymentIntent` のステータスが `processing` から `succeeded` に遷移します。 | | `generatedSepaDebitIntentsSucceedDelayed@example.com` | `PaymentIntent` のステータスが 3 分後に `processing` から `succeeded` に遷移します。 | | `generatedSepaDebitIntentsFail@example.com` | `PaymentIntent` のステータスが `processing` から `requires_payment_method` に遷移します。 | | `generatedSepaDebitIntentsFailDelayed@example.com` | `PaymentIntent` のステータスが 3 分後に `processing` から `requires_payment_method` に遷移します。 | | `generatedSepaDebitIntentsSucceedDisputed@example.com` | `PaymentIntent` のステータスが `processing` から `succeeded` に遷移しますが、不審請求の申し立てがすぐに作成されます。 | | `generatedSepaDebitIntentsFailsDueToInsufficientFunds@example.com` | `PaymentIntent` のステータスが `processing` から `requires_payment_method` に遷移し、`insufficient_funds` のエラーコードが返されます。 | #### PaymentMethod これらの PaymentMethods を使用して `PaymentIntent` のステータスの遷移をテストしてください。これらのトークンは、自動化されたテストで PaymentMethod がサーバー上の SetupIntent にすぐに関連付けられる際に役に立ちます。 | 決済手段 | 説明 | | --------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | | `pm_ideal_generatedSepaDebitIntentsSucceed` | `PaymentIntent` のステータスが `processing` から `succeeded` に遷移します。 | | `pm_ideal_generatedSepaDebitIntentsSucceedDelayed` | `PaymentIntent` のステータスが 3 分後に `processing` から `succeeded` に遷移します。 | | `pm_ideal_generatedSepaDebitIntentsFail` | `PaymentIntent` のステータスが `processing` から `requires_payment_method` に遷移します。 | | `pm_ideal_generatedSepaDebitIntentsFailDelayed` | `PaymentIntent` のステータスが 3 分後に `processing` から `requires_payment_method` に遷移します。 | | `pm_ideal_generatedSepaDebitIntentsSucceedDisputed` | `PaymentIntent` のステータスが `processing` から `succeeded` に遷移しますが、不審請求の申し立てがすぐに作成されます。 | | `pm_ideal_generatedSepaDebitIntentsFailsDueToInsufficientFunds` | `PaymentIntent` のステータスが `processing` から `requires_payment_method` に遷移し、`insufficient_funds` のエラーコードが返されます。 | ## Optional: 設定後のイベントを処理する SetupIntent が完成すると、Stripe は [setup_intent.succeeded](https://docs.stripe.com/api/events/types.md#event_types-setup_intent.succeeded) イベントを送信します。ダッシュボード、カスタム *Webhook* (A webhook is a real-time push notification sent to your application as a JSON payload through HTTPS requests)、またはパートナーソリューションを使用してこれらのイベントを受信して、生成された SEPA ダイレクトデビット *PaymentMethod* (PaymentMethods represent your customer's payment instruments, used with the Payment Intents or Setup Intents APIs) をデータベースに保存したり、トライアル期間の終了後に顧客に請求するなどのアクションを実行します。 クライアントからのコールバックを待つのではなく、これらのイベントをリッスンします。クライアント側では、コールバックが実行される前に顧客がブラウザーのウィンドウを閉じたり、アプリを終了したりする可能性があります。また、悪意を持つクライアントがレスポンスを不正操作する恐れもあります。非同期型のイベントをリッスンするよう構築済みのシステムを設定することで、これ以降はより多くの決済手段を簡単に受け付けられるようになります。[サポートされているすべての決済手段の違い](https://stripe.com/payments/payment-methods-guide)をご確認ください。 ### イベントを受信し、ビジネスアクションを実行する #### 手動 Stripe ダッシュボードを使用して、Stripe のすべての支払いの確認、メール領収書の送信、入金処理、失敗した支払いの再試行を実行します。 - [ダッシュボードでテスト支払いを確認する](https://dashboard.stripe.com/test/payments) #### カスタムコード Webhook ハンドラを構築してイベントをリッスンし、非同期型のカスタムの決済フローを作成します。Stripe CLI を使用して、ローカルで Webhook の組み込みのテストとデバッグを行います。 - [カスタム webhook を構築](https://docs.stripe.com/webhooks/handling-payment-events.md#build-your-own-webhook) #### 事前構築のアプリ [オートメーション](https://stripe.partners/?f_category=automation)や[マーケティングとセールス](https://stripe.partners/?f_category=marketing-and-sales)などの一般的なビジネスイベントを、パートナーアプリケーションとの連携によって処理します。 # iOS > This is a iOS for when payment-ui is mobile and platform is ios. View the full page at https://docs.stripe.com/payments/ideal/set-up-payment?payment-ui=mobile&platform=ios. アプリで iDEAL | Wero を使用した将来の SEPA ダイレクトデビット決済の設定は、プロセスを追跡する [SetupIntent](https://docs.stripe.com/api/setup_intents.md) オブジェクトの作成、同意書承認の収集、そして iDEAL | Wero への顧客のリダイレクトで構成されます。Stripe はこの SetupIntent を使用して、設定が完了するまで、設定のすべての状態を追跡および処理します。 ## Stripe を設定する [サーバ側] [クライアント側] まず、Stripe アカウントが必要です。[今すぐ登録](https://dashboard.stripe.com/register)してください。 ### サーバ側 この組み込みには、サーバ上に Stripe API と通信するエンドポイントが必要です。サーバから Stripe API にアクセスするには、Stripe の公式ライブラリを使用します。 #### Ruby ```bash # Available as a gem sudo gem install stripe ``` ```ruby # If you use bundler, you can add this line to your Gemfile gem 'stripe' ``` ### クライアント側 [Stripe iOS SDK](https://github.com/stripe/stripe-ios) はオープンソースです。[詳細なドキュメントが提供されており](https://stripe.dev/stripe-ios/index.html)、iOS 13 以降をサポートするアプリと互換性があります。 #### Swift Package Manager SDK をインストールするには、以下のステップに従います。 1. Xcode で、**File (ファイル)** > **Add Package Dependencies… (パッケージ依存関係を追加)** を選択し、リポジトリー URL として `https://github.com/stripe/stripe-ios-spm` を入力します。 1. [リリースページ](https://github.com/stripe/stripe-ios/releases)から最新のバージョン番号を選択します。 1. **StripePaymentsUI** 製品を[アプリのターゲット](https://developer.apple.com/documentation/swift_packages/adding_package_dependencies_to_your_app)に追加します。 #### CocoaPods 1. まだインストールしていない場合は、[CocoaPods](https://guides.cocoapods.org/using/getting-started.html) の最新バージョンをインストールします。 1. 既存の [Podfile](https://guides.cocoapods.org/syntax/podfile.html) がない場合は、以下のコマンドを実行して作成します。 ```bash pod init ``` 1. この行を `Podfile` に追加します。 ```podfile pod 'StripePaymentsUI' ``` 1. 以下のコマンドを実行します。 ```bash pod install ``` 1. これ以降は、Xcode でプロジェクトを開く際に、`.xcodeproj` ファイルではなく、必ず `.xcworkspace` ファイルを使用するということを忘れないでください。 1. 今後、SDK の最新バージョンに更新するには、以下を実行します。 ```bash pod update StripePaymentsUI ``` #### Carthage 1. まだインストールしていない場合は、[Carthage](https://github.com/Carthage/Carthage#installing-carthage) の最新バージョンをインストールします。 1. この行を `Cartfile` に追加します。 ```cartfile github "stripe/stripe-ios" ``` 1. [Carthage のインストール手順](https://github.com/Carthage/Carthage#if-youre-building-for-ios-tvos-or-watchos)に従います。必ず、[こちら](https://github.com/stripe/stripe-ios/tree/master/StripePaymentsUI/README.md#manual-linking)にリストされている必要なフレームワークのすべてを埋め込んでください。 1. 今後、SDK の最新バージョンに更新するには、以下のコマンドを実行します。 ```bash carthage update stripe-ios --platform ios ``` #### 手動のフレームワーク 1. Stripe の [GitHub リリースページ](https://github.com/stripe/stripe-ios/releases/latest)に移動して、**Stripe.xcframework.zip** をダウンロードして解凍します。 1. **StripePaymentsUI.xcframework** を、Xcode プロジェクトの **General (一般) ** 設定の **Embedded Binaries (埋め込みバイナリー)** セクションにドラッグします。**Copy items if needed (必要に応じてアイテムをコピーする)** を必ず選択してください。 1. [こちら](https://github.com/stripe/stripe-ios/tree/master/StripePaymentsUI/README.md#manual-linking)にリストされている必要なフレームワークのすべてに対して、ステップ 2 を繰り返します。 1. 今後、Stripe の SDK の最新バージョンに更新するには、ステップ 1 から 3 を繰り返します。 > SDK の最新リリースおよび過去バージョンの詳細については、GitHub の [Releases (リリース)](https://github.com/stripe/stripe-ios/releases) ページをご覧ください。リポジトリの[リリースをウォッチ](https://help.github.com/en/articles/watching-and-unwatching-releases-for-a-repository#watching-releases-for-a-repository)して、新しいリリースの公開時に通知を受け取ることも可能です。 アプリの起動時に Stripe [公開可能キー](https://dashboard.stripe.com/test/apikeys)を使用して SDK を設定します。これにより、アプリが Stripe API にリクエストを送信できるようになります。 #### Swift ```swift import UIKitimportStripePaymentsUI @main class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {StripeAPI.defaultPublishableKey = "<>" // do any other necessary launch configuration return true } } ``` > テストおよび開発時には[テストキー](https://docs.stripe.com/keys.md#obtain-api-keys)を使用し、アプリの公開時には[本番環境](https://docs.stripe.com/keys.md#test-live-modes)キーを使用します。 ## 顧客を作成または取得する [サーバー側] > #### Accounts v2 API を使用した顧客の表現 > > Accounts v2 API では、Connect ユーザーには一般提供され、その他の Stripe ユーザーには公開プレビューで提供されます。Accounts v2 プレビューの一部である場合は、コードで[プレビューバージョン](https://docs.stripe.com/api-v2-overview.md#sdk-and-api-versioning)を指定する必要があります。 > > Accounts v2 プレビューへのアクセスをリクエストするには、 > > ほとんどのユースケースでは、[Customer](https://docs.stripe.com/api/customers.md) オブジェクトを使用するのではなく、[顧客を顧客設定済みの Account オブジェクトとしてモデル化する](https://docs.stripe.com/accounts-v2/use-accounts-as-customers.md)ことをお勧めします。 顧客がビジネスでアカウントを作成するとき、または決済手段を保存するときに、顧客設定の [Account](https://docs.stripe.com/api/v2/core/accounts/create.md#v2_create_accounts-configuration-customer) または [Customer](https://docs.stripe.com/api/customers/create.md) を作成する。オブジェクトの ID を、顧客を表す独自の内部表現に関連付ける。 この決済に関連付ける新しい顧客を作成するか、既存の顧客を取得する。 #### Accounts v2 ```curl curl -X POST https://api.stripe.com/v2/core/accounts \ -H "Authorization: Bearer <>" \ -H "Stripe-Version: 2026-04-22.preview" \ --json '{ "contact_email": "jenny.rosen@example.com", "display_name": "Jenny Rosen", "configuration": { "customer": {} }, "include": [ "configuration.customer" ] }' ``` #### Customers v1 ```curl curl https://api.stripe.com/v1/customers \ -u "<>:" \ -d "name=Jenny Rosen" \ --data-urlencode "email=jenny.rosen@example.com" ``` ## SetupIntent を作成する [サーバー側] 顧客の ID を使用して `SetupIntent` を作成し、`ideal` を [payment_method_types](https://docs.stripe.com/api/setup_intents/create.md#create_setup_intent-payment_method_types) 配列に追加します。`SetupIntent` はセットアッププロセスの手順を追跡します。iDEAL | Wero の場合、これには顧客から [SEPA ダイレクトデビットの同意書](https://www.europeanpaymentscouncil.eu/what-we-do/sepa-direct-debit/sdd-mandate) を取得し、その有効性を追跡することが含まれます。 #### Accounts v2 ```curl curl https://api.stripe.com/v1/setup_intents \ -u "<>:" \ -d "payment_method_types[]=ideal" \ -d "customer_account={{CUSTOMERACCOUNT_ID}}" ``` #### Customers v1 ```curl curl https://api.stripe.com/v1/setup_intents \ -u "<>:" \ -d "payment_method_types[]=ideal" \ -d customer={{CUSTOMER_ID}} ``` ## 支払い方法の詳細を収集する [クライアント側] アプリでは、顧客の氏名とメールアドレスを収集します。それらの情報を使用して [STPPaymentMethodParams](https://stripe.dev/stripe-ios/stripe-payments/Classes/STPPaymentMethodParams.html) オブジェクトを作成します。 #### Swift ```swift let billingDetails = STPPaymentMethodBillingDetails() billingDetails.name = "Jane Doe" billingDetails.email = "jane.doe@example.com" let paymentMethodParams = STPPaymentMethodParams(billingDetails: billingDetails, metadata: nil) ``` SEPA ダイレクトデビットの支払いを処理するには、顧客から同意書を収集する必要があります。以下に示す定型の承認用文書を表示し、顧客が黙示的にこの同意書に署名するようにしてください。 「Rocket Rides」はお客様の社名に置き換えます。 #### de Durch Angabe Ihrer Zahlungsinformationen und der Bestätigung der vorliegenden Zahlung ermächtigen Sie (A) und Stripe, unseren Zahlungsdienstleister, Ihrem Kreditinstitut Anweisungen zur Belastung Ihres Kontos zu erteilen, und (B) Ihr Kreditinstitut, Ihr Konto gemäß diesen Anweisungen zu belasten. Im Rahmen Ihrer Rechte haben Sie, entsprechend den Vertragsbedingungen mit Ihrem Kreditinstitut, Anspruch auf eine Rückerstattung von Ihrem Kreditinstitut. Eine Rückerstattung muss innerhalb von 8 Wochen ab dem Tag, an dem Ihr Konto belastet wurde, geltend gemacht werden. Eine Erläuterung Ihrer Rechte können Sie von Ihrem Kreditinstitut anfordern. Sie erklären sich einverstanden, Benachrichtigungen über künftige Belastungen bis spätestens 2 Tage vor dem Buchungsdatum zu erhalten. #### en By providing your payment information and confirming this payment, you authorise (A) and Stripe, our payment service provider, to send instructions to your bank to debit your account and (B) your bank to debit your account in accordance with those instructions. As part of your rights, you’re entitled to a refund from your bank under the terms and conditions of your agreement with your bank. A refund must be claimed within 8 weeks starting from the date on which your account was debited. Your rights are explained in a statement that you can obtain from your bank. You agree to receive notifications for future debits up to 2 days before they occur. #### es Al proporcionar sus datos de pago y confirmar este pago, usted autoriza a (A) y Stripe, nuestro proveedor de servicios de pago, a enviar instrucciones a su banco para realizar un débito en su cuenta y (B) a su banco a realizar un cargo en su cuenta de conformidad con dichas instrucciones. Como parte de sus derechos, usted tiene derecho a un reembolso de su banco conforme a los términos y condiciones del contrato con su banco. El reembolso debe reclamarse en un plazo de 8 semanas a partir de la fecha en la que se haya efectuado el cargo en su cuenta. Sus derechos se explican en un extracto que puede obtener en su banco. Usted acepta recibir notificaciones de futuros débitos hasta 2 días antes de que se produzcan. #### fi Antamalla maksutiedot ja vahvistamalla tämän maksun, valtuutat (A) ja Stripen, maksupalveluntarjoajamme, lähettämään ohjeet pankille tilisi veloittamiseksi ja (B) pankkisi veloittamaan tiliäsi kyseisten ohjeiden mukaisesti. Oikeuksiesi mukaisesti olet oikeutettu maksun palautukseen pankilta, kuten heidän kanssaan tekemässäsi sopimuksessa ja sen ehdoissa on kuvattu. Maksun palautus on lunastettava 8 viikon aikana alkaen päivästä, jolloin tiliäsi veloitettiin. Oikeutesi on selitetty pankilta saatavissa olevassa lausunnossa. Hyväksyt vastaanottamaan ilmoituksia tulevista veloituksista jopa kaksi päivää ennen niiden tapahtumista. #### fr En fournissant vos informations de paiement et en confirmant ce paiement, vous autorisez (A) et Stripe, notre prestataire de services de paiement et/ou PPRO, son prestataire de services local, à envoyer des instructions à votre banque pour débiter votre compte et (B) votre banque à débiter votre compte conformément à ces instructions. Vous avez, entre autres, le droit de vous faire rembourser par votre banque selon les modalités et conditions du contrat conclu avec votre banque. La demande de remboursement doit être soumise dans un délai de 8 semaines à compter de la date à laquelle votre compte a été débité. Vos droits sont expliqués dans une déclaration disponible auprès de votre banque. Vous acceptez de recevoir des notifications des débits à venir dans les 2 jours précédant leur réalisation. #### it Fornendo i dati di pagamento e confermando il pagamento, l’utente autorizza (A) e Stripe, il fornitore del servizio di pagamento locale, a inviare alla sua banca le istruzioni per eseguire addebiti sul suo conto e (B) la sua banca a effettuare addebiti conformemente a tali istruzioni. L’utente, fra le altre cose, ha diritto a un rimborso dalla banca, in base a termini e condizioni dell’accordo sottoscritto con l’istituto. Il rimborso va richiesto entro otto settimane dalla data dell’addebito sul conto. I diritti dell’utente sono illustrati in una comunicazione riepilogativa che è possibile richiedere alla banca. L’utente accetta di ricevere notifiche per i futuri addebiti fino a due giorni prima che vengano effettuati. #### nl Door je betaalgegevens door te geven en deze betaling te bevestigen, geef je (A) en Stripe, onze betaaldienst, toestemming om instructies naar je bank te verzenden om het bedrag van je rekening af te schrijven, en (B) geef je je bank toestemming om het bedrag van je rekening af te schrijven conform deze aanwijzingen. Als onderdeel van je rechten kom je in aanmerking voor een terugbetaling van je bank conform de voorwaarden van je overeenkomst met de bank. Je moet terugbetalingen binnen acht weken claimen vanaf de datum waarop het bedrag is afgeschreven van je rekening. Je rechten worden toegelicht in een overzicht dat je bij de bank kunt opvragen. Je gaat ermee akkoord meldingen te ontvangen voor toekomstige afschrijvingen tot twee dagen voordat deze plaatsvinden. 支払い方法を設定すると、承認済みの同意書が作成されます。これらの規約を受け入れる際、顧客は黙示的に同意書に署名したため、フォームまたはメールを通じて、顧客にこれらの規約を伝える必要があります。 ## Stripe に支払い方法の詳細を送信する [クライアント側] 作成した SetupIntent から client secret を取得し、[STPPaymentHandler confirmSetupIntent](https://stripe.dev/stripe-ios/stripe-payments/Classes/STPPaymentHandler.html#/c:objc\(cs\)STPPaymentHandler\(im\)confirmSetupIntent:withAuthenticationContext:completion:) をコールします。これにより Webview が表示され、顧客はそこから銀行のウェブサイトまたはアプリで支払いを完了できます。その後、支払い結果とともに、完了ブロックが呼び出されます。 #### Swift ```swift let setupIntentParams = STPSetupIntentConfirmParams(clientSecret: paymentIntentClientSecret) setupIntentParams.paymentMethodParams = paymentMethodParams STPPaymentHandler.shared().confirmSetupIntent(withParams: setupIntentParams, authenticationContext: self) { (handlerStatus, setupIntent, error) in switch handlerStatus { case .succeeded: // Setup succeeded case .canceled: // Setup was canceled case .failed: // Setup failed @unknown default: fatalError() } } ``` ## 後日 SEPA ダイレクトデビット PaymentMethod に請求する 顧客に再度請求する必要が生じたときは、新しい PaymentIntent を作成します。SetupIntent を[取得](https://docs.stripe.com/api/setup_intents/retrieve.md)し、`latest_attempt` フィールドを[展開](https://docs.stripe.com/api/expanding_objects.md)して `payment_method_details` 内の `generated_sepa_debit` ID を探すことで、SEPA ダイレクトデビットの決済手段の ID を見つけます。 ```curl curl -G https://api.stripe.com/v1/setup_intents/{{SETUP_INTENT_ID}} \ -u "<>:" \ -d "expand[]=latest_attempt" ``` SEPA ダイレクトデビット ID と顧客の ID を使用して、`PaymentIntent` を作成します。 #### Accounts v2 ```curl curl https://api.stripe.com/v1/payment_intents \ -u "<>:" \ -d "payment_method_types[]=sepa_debit" \ -d amount=1099 \ -d currency=eur \ -d "customer_account={{CUSTOMERACCOUNT_ID}}" \ -d payment_method={{SEPA_DEBIT_PAYMENT_METHOD_ID}} \ -d confirm=true ``` #### Customers v1 ```curl curl https://api.stripe.com/v1/payment_intents \ -u "<>:" \ -d "payment_method_types[]=sepa_debit" \ -d amount=1099 \ -d currency=eur \ -d "customer={{CUSTOMER_ID}}" \ -d payment_method={{SEPA_DEBIT_PAYMENT_METHOD_ID}} \ -d confirm=true ``` ## 導入をテストする [テスト API キー](https://docs.stripe.com/keys.md#test-live-modes)を使用して SetupIntent を確定します。確定すると、決済手段の設定を承認または失敗させるオプションのあるテストページにリダイレクトされます。 - **Authorize test payment (テスト支払いをオーソリする)** をクリックして、設定成功のケースをテストします。SetupIntent が `requires_action` から `succeeded` に変わります。 - **Fail test payment (テスト支払いを失敗させる)** をクリックして、顧客が認証に失敗するケースをテストします。SetupIntent が `requires_action` から `requires_payment_method` に変わります。 ### SEPA ダイレクトデビット組み込みのテスト #### メール `payment_method.billing_details.email` を以下のいずれかの値に設定して、`PaymentIntent` のステータス遷移をテストしてください。任意のテキストとアンダースコアをメールアドレスの前に追加することもできます。例えば、`test_1_generatedSepaDebitIntentsFail@example.com` を使用すると、`PaymentIntent` で使用した際に必ず失敗する SEPA ダイレクトデビットの PaymentMethodになります。 | メールアドレス | 説明 | | ------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------- | | `generatedSepaDebitIntentsSucceed@example.com` | `PaymentIntent` のステータスが `processing` から `succeeded` に遷移します。 | | `generatedSepaDebitIntentsSucceedDelayed@example.com` | `PaymentIntent` のステータスが 3 分後に `processing` から `succeeded` に遷移します。 | | `generatedSepaDebitIntentsFail@example.com` | `PaymentIntent` のステータスが `processing` から `requires_payment_method` に遷移します。 | | `generatedSepaDebitIntentsFailDelayed@example.com` | `PaymentIntent` のステータスが 3 分後に `processing` から `requires_payment_method` に遷移します。 | | `generatedSepaDebitIntentsSucceedDisputed@example.com` | `PaymentIntent` のステータスが `processing` から `succeeded` に遷移しますが、不審請求の申し立てがすぐに作成されます。 | | `generatedSepaDebitIntentsFailsDueToInsufficientFunds@example.com` | `PaymentIntent` のステータスが `processing` から `requires_payment_method` に遷移し、`insufficient_funds` のエラーコードが返されます。 | #### PaymentMethod これらの PaymentMethods を使用して `PaymentIntent` のステータスの遷移をテストしてください。これらのトークンは、自動化されたテストで PaymentMethod がサーバー上の SetupIntent にすぐに関連付けられる際に役に立ちます。 | 決済手段 | 説明 | | --------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | | `pm_ideal_generatedSepaDebitIntentsSucceed` | `PaymentIntent` のステータスが `processing` から `succeeded` に遷移します。 | | `pm_ideal_generatedSepaDebitIntentsSucceedDelayed` | `PaymentIntent` のステータスが 3 分後に `processing` から `succeeded` に遷移します。 | | `pm_ideal_generatedSepaDebitIntentsFail` | `PaymentIntent` のステータスが `processing` から `requires_payment_method` に遷移します。 | | `pm_ideal_generatedSepaDebitIntentsFailDelayed` | `PaymentIntent` のステータスが 3 分後に `processing` から `requires_payment_method` に遷移します。 | | `pm_ideal_generatedSepaDebitIntentsSucceedDisputed` | `PaymentIntent` のステータスが `processing` から `succeeded` に遷移しますが、不審請求の申し立てがすぐに作成されます。 | | `pm_ideal_generatedSepaDebitIntentsFailsDueToInsufficientFunds` | `PaymentIntent` のステータスが `processing` から `requires_payment_method` に遷移し、`insufficient_funds` のエラーコードが返されます。 | ## Optional: 設定後のイベントを処理する SetupIntent が完成すると、Stripe は [setup_intent.succeeded](https://docs.stripe.com/api/events/types.md#event_types-setup_intent.succeeded) イベントを送信します。ダッシュボード、カスタム *Webhook* (A webhook is a real-time push notification sent to your application as a JSON payload through HTTPS requests)、またはパートナーソリューションを使用してこれらのイベントを受信して、生成された SEPA ダイレクトデビット *PaymentMethod* (PaymentMethods represent your customer's payment instruments, used with the Payment Intents or Setup Intents APIs) をデータベースに保存したり、トライアル期間の終了後に顧客に請求するなどのアクションを実行します。 クライアントからのコールバックを待つのではなく、これらのイベントをリッスンします。クライアント側では、コールバックが実行される前に顧客がブラウザーのウィンドウを閉じたり、アプリを終了したりする可能性があります。また、悪意を持つクライアントがレスポンスを不正操作する恐れもあります。非同期型のイベントをリッスンするよう構築済みのシステムを設定することで、これ以降はより多くの決済手段を簡単に受け付けられるようになります。[サポートされているすべての決済手段の違い](https://stripe.com/payments/payment-methods-guide)をご確認ください。 ### イベントを受信し、ビジネスアクションを実行する #### 手動 Stripe ダッシュボードを使用して、Stripe のすべての支払いの確認、メール領収書の送信、入金処理、失敗した支払いの再試行を実行します。 - [ダッシュボードでテスト支払いを確認する](https://dashboard.stripe.com/test/payments) #### カスタムコード Webhook ハンドラを構築してイベントをリッスンし、非同期型のカスタムの決済フローを作成します。Stripe CLI を使用して、ローカルで Webhook の組み込みのテストとデバッグを行います。 - [カスタム webhook を構築](https://docs.stripe.com/webhooks/handling-payment-events.md#build-your-own-webhook) #### 事前構築のアプリ [オートメーション](https://stripe.partners/?f_category=automation)や[マーケティングとセールス](https://stripe.partners/?f_category=marketing-and-sales)などの一般的なビジネスイベントを、パートナーアプリケーションとの連携によって処理します。 # Android > This is a Android for when payment-ui is mobile and platform is android. View the full page at https://docs.stripe.com/payments/ideal/set-up-payment?payment-ui=mobile&platform=android. アプリで iDEAL | Wero を使用して将来の SEPA ダイレクトデビット決済を設定するには、プロセスを追跡するための [SetupIntent](https://docs.stripe.com/api/setup_intents.md) を作成し、同意書の確認を収集して、顧客を iDEAL | Wero にリダイレクトします。Stripe は `SetupIntent` を使用して、セットアップが完了するまでのすべての状態を追跡および処理します。 ## Stripe を設定する [サーバ側] [クライアント側] まず、Stripe アカウントが必要です。[今すぐ登録](https://dashboard.stripe.com/register)してください。 ### サーバ側 この組み込みには、サーバ上に Stripe API と通信するエンドポイントが必要です。サーバから Stripe API にアクセスするには、Stripe の公式ライブラリを使用します。 #### Ruby ```bash # Available as a gem sudo gem install stripe ``` ```ruby # If you use bundler, you can add this line to your Gemfile gem 'stripe' ``` ### クライアント側 [Stripe Android SDK](https://github.com/stripe/stripe-android) はオープンソースであり、[詳細なドキュメントが提供されています](https://stripe.dev/stripe-android/)。 SDK をインストールするには、[app/build.gradle](https://developer.android.com/studio/build/dependencies) ファイルの `dependencies` ブロックに `stripe-android` を追加します。 #### Kotlin ```kotlin plugins { id("com.android.application") } android { ... } dependencies { // ... // Stripe Android SDK implementation("com.stripe:stripe-android:23.9.0") // Include the financial connections SDK to support US bank account as a payment method implementation("com.stripe:financial-connections:23.9.0") } ``` > SDK の最新リリースおよび過去バージョンの詳細については、GitHub の [Releases](https://github.com/stripe/stripe-android/releases) ページをご覧ください。新しいリリースの公開時に通知を受け取るには、[リポジトリのリリースを確認](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/configuring-notifications#configuring-your-watch-settings-for-an-individual-repository)してください。 Stripe の[公開可能キー](https://dashboard.stripe.com/apikeys)を使用して SDK を設定し、 `Application` サブクラスなどで、Stripe API へのリクエストを実行できるようにします。 #### Kotlin ```kotlin import com.stripe.android.PaymentConfiguration class MyApp : Application() { override fun onCreate() { super.onCreate() PaymentConfiguration.init( applicationContext, "<>" ) } } ``` > テストおよび開発時には[テストキー](https://docs.stripe.com/keys.md#obtain-api-keys)を使用し、アプリの公開時には[本番環境](https://docs.stripe.com/keys.md#test-live-modes)キーを使用します。 Stripe サンプルでは、サーバへの HTTP リクエストの作成に、[OkHttp](https://github.com/square/okhttp) および [GSON](https://github.com/google/gson) も使用します。 ## 顧客を作成または取得する [サーバー側] > #### Accounts v2 API を使用した顧客の表現 > > Accounts v2 API では、Connect ユーザーには一般提供され、その他の Stripe ユーザーには公開プレビューで提供されます。Accounts v2 プレビューの一部である場合は、コードで[プレビューバージョン](https://docs.stripe.com/api-v2-overview.md#sdk-and-api-versioning)を指定する必要があります。 > > Accounts v2 プレビューへのアクセスをリクエストするには、 > > ほとんどのユースケースでは、[Customer](https://docs.stripe.com/api/customers.md) オブジェクトを使用するのではなく、[顧客を顧客設定済みの Account オブジェクトとしてモデル化する](https://docs.stripe.com/accounts-v2/use-accounts-as-customers.md)ことをお勧めします。 顧客がビジネスでアカウントを作成するとき、または決済手段を保存するときに、顧客設定の [Account](https://docs.stripe.com/api/v2/core/accounts/create.md#v2_create_accounts-configuration-customer) または [Customer](https://docs.stripe.com/api/customers/create.md) を作成する。オブジェクトの ID を、顧客を表す独自の内部表現に関連付ける。 この決済に関連付ける新しい顧客を作成するか、既存の顧客を取得する。 #### Accounts v2 ```curl curl -X POST https://api.stripe.com/v2/core/accounts \ -H "Authorization: Bearer <>" \ -H "Stripe-Version: 2026-04-22.preview" \ --json '{ "contact_email": "jenny.rosen@example.com", "display_name": "Jenny Rosen", "configuration": { "customer": {} }, "include": [ "configuration.customer" ] }' ``` #### Customers v1 ```curl curl https://api.stripe.com/v1/customers \ -u "<>:" \ -d "name=Jenny Rosen" \ --data-urlencode "email=jenny.rosen@example.com" ``` ## SetupIntent を作成する [サーバー側] 顧客の ID を使用して `SetupIntent` を作成し、`ideal` を [payment_method_types](https://docs.stripe.com/api/setup_intents/create.md#create_setup_intent-payment_method_types) 配列に追加します。`SetupIntent` はセットアッププロセスの手順を追跡します。iDEAL | Wero の場合、これには顧客から [SEPA ダイレクトデビットの同意書](https://www.europeanpaymentscouncil.eu/what-we-do/sepa-direct-debit/sdd-mandate) を取得し、その有効性を追跡することが含まれます。 #### Accounts v2 ```curl curl https://api.stripe.com/v1/setup_intents \ -u "<>:" \ -d "payment_method_types[]=ideal" \ -d "customer_account={{CUSTOMERACCOUNT_ID}}" ``` #### Customers v1 ```curl curl https://api.stripe.com/v1/setup_intents \ -u "<>:" \ -d "payment_method_types[]=ideal" \ -d customer={{CUSTOMER_ID}} ``` ## 支払い方法の詳細と同意書承認を収集する [クライアント側] アプリで顧客の氏名とメールアドレスを収集します。それらの情報を使用して [PaymentMethodCreateParams](https://stripe.dev/stripe-android/payments-core/com.stripe.android.model/-payment-method-create-params/index.html) オブジェクトを作成します。 #### Kotlin ```kotlin val billingDetails = PaymentMethod.BillingDetails(name = "Jenny Rosen", email = "jenny.rosen@example.com") val ideal = PaymentMethodCreateParams.Ideal(null) val paymentMethodCreateParams = PaymentMethodCreateParams.create(ideal, billingDetails) ``` SEPA ダイレクトデビットの支払いを処理するには、顧客から同意書を収集する必要があります。以下に示す定型の承認用文書を表示し、顧客が黙示的にこの同意書に署名するようにしてください。 「Rocket Rides」はお客様の社名に置き換えます。 #### de Durch Angabe Ihrer Zahlungsinformationen und der Bestätigung der vorliegenden Zahlung ermächtigen Sie (A) und Stripe, unseren Zahlungsdienstleister, Ihrem Kreditinstitut Anweisungen zur Belastung Ihres Kontos zu erteilen, und (B) Ihr Kreditinstitut, Ihr Konto gemäß diesen Anweisungen zu belasten. Im Rahmen Ihrer Rechte haben Sie, entsprechend den Vertragsbedingungen mit Ihrem Kreditinstitut, Anspruch auf eine Rückerstattung von Ihrem Kreditinstitut. Eine Rückerstattung muss innerhalb von 8 Wochen ab dem Tag, an dem Ihr Konto belastet wurde, geltend gemacht werden. Eine Erläuterung Ihrer Rechte können Sie von Ihrem Kreditinstitut anfordern. Sie erklären sich einverstanden, Benachrichtigungen über künftige Belastungen bis spätestens 2 Tage vor dem Buchungsdatum zu erhalten. #### en By providing your payment information and confirming this payment, you authorise (A) and Stripe, our payment service provider, to send instructions to your bank to debit your account and (B) your bank to debit your account in accordance with those instructions. As part of your rights, you’re entitled to a refund from your bank under the terms and conditions of your agreement with your bank. A refund must be claimed within 8 weeks starting from the date on which your account was debited. Your rights are explained in a statement that you can obtain from your bank. You agree to receive notifications for future debits up to 2 days before they occur. #### es Al proporcionar sus datos de pago y confirmar este pago, usted autoriza a (A) y Stripe, nuestro proveedor de servicios de pago, a enviar instrucciones a su banco para realizar un débito en su cuenta y (B) a su banco a realizar un cargo en su cuenta de conformidad con dichas instrucciones. Como parte de sus derechos, usted tiene derecho a un reembolso de su banco conforme a los términos y condiciones del contrato con su banco. El reembolso debe reclamarse en un plazo de 8 semanas a partir de la fecha en la que se haya efectuado el cargo en su cuenta. Sus derechos se explican en un extracto que puede obtener en su banco. Usted acepta recibir notificaciones de futuros débitos hasta 2 días antes de que se produzcan. #### fi Antamalla maksutiedot ja vahvistamalla tämän maksun, valtuutat (A) ja Stripen, maksupalveluntarjoajamme, lähettämään ohjeet pankille tilisi veloittamiseksi ja (B) pankkisi veloittamaan tiliäsi kyseisten ohjeiden mukaisesti. Oikeuksiesi mukaisesti olet oikeutettu maksun palautukseen pankilta, kuten heidän kanssaan tekemässäsi sopimuksessa ja sen ehdoissa on kuvattu. Maksun palautus on lunastettava 8 viikon aikana alkaen päivästä, jolloin tiliäsi veloitettiin. Oikeutesi on selitetty pankilta saatavissa olevassa lausunnossa. Hyväksyt vastaanottamaan ilmoituksia tulevista veloituksista jopa kaksi päivää ennen niiden tapahtumista. #### fr En fournissant vos informations de paiement et en confirmant ce paiement, vous autorisez (A) et Stripe, notre prestataire de services de paiement et/ou PPRO, son prestataire de services local, à envoyer des instructions à votre banque pour débiter votre compte et (B) votre banque à débiter votre compte conformément à ces instructions. Vous avez, entre autres, le droit de vous faire rembourser par votre banque selon les modalités et conditions du contrat conclu avec votre banque. La demande de remboursement doit être soumise dans un délai de 8 semaines à compter de la date à laquelle votre compte a été débité. Vos droits sont expliqués dans une déclaration disponible auprès de votre banque. Vous acceptez de recevoir des notifications des débits à venir dans les 2 jours précédant leur réalisation. #### it Fornendo i dati di pagamento e confermando il pagamento, l’utente autorizza (A) e Stripe, il fornitore del servizio di pagamento locale, a inviare alla sua banca le istruzioni per eseguire addebiti sul suo conto e (B) la sua banca a effettuare addebiti conformemente a tali istruzioni. L’utente, fra le altre cose, ha diritto a un rimborso dalla banca, in base a termini e condizioni dell’accordo sottoscritto con l’istituto. Il rimborso va richiesto entro otto settimane dalla data dell’addebito sul conto. I diritti dell’utente sono illustrati in una comunicazione riepilogativa che è possibile richiedere alla banca. L’utente accetta di ricevere notifiche per i futuri addebiti fino a due giorni prima che vengano effettuati. #### nl Door je betaalgegevens door te geven en deze betaling te bevestigen, geef je (A) en Stripe, onze betaaldienst, toestemming om instructies naar je bank te verzenden om het bedrag van je rekening af te schrijven, en (B) geef je je bank toestemming om het bedrag van je rekening af te schrijven conform deze aanwijzingen. Als onderdeel van je rechten kom je in aanmerking voor een terugbetaling van je bank conform de voorwaarden van je overeenkomst met de bank. Je moet terugbetalingen binnen acht weken claimen vanaf de datum waarop het bedrag is afgeschreven van je rekening. Je rechten worden toegelicht in een overzicht dat je bij de bank kunt opvragen. Je gaat ermee akkoord meldingen te ontvangen voor toekomstige afschrijvingen tot twee dagen voordat deze plaatsvinden. 支払い方法を設定すると、承認済みの同意書が作成されます。これらの規約を受け入れる際、顧客は黙示的に同意書に署名したため、フォームまたはメールを通じて、顧客にこれらの規約を伝える必要があります。 ## Stripe に支払い方法の詳細を送信する [クライアント側] 作成した SetupIntent から client secret を取得し、[PaymentLauncher confirm](https://stripe.dev/stripe-android/payments-core/com.stripe.android.payments.paymentlauncher/-payment-launcher/index.html#74063765%2FFunctions%2F-1622557690) を呼び出します。これにより、Webview が表示され、顧客は銀行のウェブサイトまたはアプリで設定を完了できます。完了後、支払い結果とともに、`onPaymentResult` が呼び出されます。 #### Kotlin ```kotlin class IdealSetupActivity : AppCompatActivity() { // ... private lateinit var setupIntentClientSecret: String private val paymentLauncher: PaymentLauncher by lazy { PaymentLauncher.Companion.create( this, PaymentConfiguration.getInstance(applicationContext).publishableKey, PaymentConfiguration.getInstance(applicationContext).stripeAccountId, ::onPaymentResult ) } private fun startCheckout() { // ... val confirmParams = ConfirmSetupIntentParams .create( paymentMethodCreateParams = paymentMethodCreateParams, clientSecret = setupIntentClientSecret ) paymentLauncher.confirm(confirmParams) } private fun onPaymentResult(paymentResult: PaymentResult) { val message = when (paymentResult) { is PaymentResult.Completed -> { "Completed!" } is PaymentResult.Canceled -> { "Canceled!" } is PaymentResult.Failed -> { // This string comes from the PaymentIntent's error message. // See here: https://stripe.com/docs/api/payment_intents/object#payment_intent_object-last_payment_error-message "Failed: " + paymentResult.throwable.message } } } } ``` ## 後日 SEPA ダイレクトデビット PaymentMethod に請求する 顧客に再度請求する必要が生じたときは、新しい PaymentIntent を作成します。SetupIntent を[取得](https://docs.stripe.com/api/setup_intents/retrieve.md)し、`latest_attempt` フィールドを[展開](https://docs.stripe.com/api/expanding_objects.md)して `payment_method_details` 内の `generated_sepa_debit` ID を探すことで、SEPA ダイレクトデビットの決済手段の ID を見つけます。 ```curl curl -G https://api.stripe.com/v1/setup_intents/{{SETUP_INTENT_ID}} \ -u "<>:" \ -d "expand[]=latest_attempt" ``` SEPA ダイレクトデビット ID と顧客の ID を使用して、`PaymentIntent` を作成します。 #### Accounts v2 ```curl curl https://api.stripe.com/v1/payment_intents \ -u "<>:" \ -d "payment_method_types[]=sepa_debit" \ -d amount=1099 \ -d currency=eur \ -d "customer_account={{CUSTOMERACCOUNT_ID}}" \ -d payment_method={{SEPA_DEBIT_PAYMENT_METHOD_ID}} \ -d confirm=true ``` #### Customers v1 ```curl curl https://api.stripe.com/v1/payment_intents \ -u "<>:" \ -d "payment_method_types[]=sepa_debit" \ -d amount=1099 \ -d currency=eur \ -d "customer={{CUSTOMER_ID}}" \ -d payment_method={{SEPA_DEBIT_PAYMENT_METHOD_ID}} \ -d confirm=true ``` ## 導入をテストする [テスト API キー](https://docs.stripe.com/keys.md#test-live-modes)を使用して SetupIntent を確定します。確定すると、決済手段の設定を承認または失敗させるオプションのあるテストページにリダイレクトされます。 - **Authorize test payment (テスト支払いをオーソリする)** をクリックして、設定成功のケースをテストします。SetupIntent が `requires_action` から `succeeded` に変わります。 - **Fail test payment (テスト支払いを失敗させる)** をクリックして、顧客が認証に失敗するケースをテストします。SetupIntent が `requires_action` から `requires_payment_method` に変わります。 ### SEPA ダイレクトデビット組み込みのテスト #### メール `payment_method.billing_details.email` を以下のいずれかの値に設定して、`PaymentIntent` のステータス遷移をテストしてください。任意のテキストとアンダースコアをメールアドレスの前に追加することもできます。例えば、`test_1_generatedSepaDebitIntentsFail@example.com` を使用すると、`PaymentIntent` で使用した際に必ず失敗する SEPA ダイレクトデビットの PaymentMethodになります。 | メールアドレス | 説明 | | ------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------- | | `generatedSepaDebitIntentsSucceed@example.com` | `PaymentIntent` のステータスが `processing` から `succeeded` に遷移します。 | | `generatedSepaDebitIntentsSucceedDelayed@example.com` | `PaymentIntent` のステータスが 3 分後に `processing` から `succeeded` に遷移します。 | | `generatedSepaDebitIntentsFail@example.com` | `PaymentIntent` のステータスが `processing` から `requires_payment_method` に遷移します。 | | `generatedSepaDebitIntentsFailDelayed@example.com` | `PaymentIntent` のステータスが 3 分後に `processing` から `requires_payment_method` に遷移します。 | | `generatedSepaDebitIntentsSucceedDisputed@example.com` | `PaymentIntent` のステータスが `processing` から `succeeded` に遷移しますが、不審請求の申し立てがすぐに作成されます。 | | `generatedSepaDebitIntentsFailsDueToInsufficientFunds@example.com` | `PaymentIntent` のステータスが `processing` から `requires_payment_method` に遷移し、`insufficient_funds` のエラーコードが返されます。 | #### PaymentMethod これらの PaymentMethods を使用して `PaymentIntent` のステータスの遷移をテストしてください。これらのトークンは、自動化されたテストで PaymentMethod がサーバー上の SetupIntent にすぐに関連付けられる際に役に立ちます。 | 決済手段 | 説明 | | --------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | | `pm_ideal_generatedSepaDebitIntentsSucceed` | `PaymentIntent` のステータスが `processing` から `succeeded` に遷移します。 | | `pm_ideal_generatedSepaDebitIntentsSucceedDelayed` | `PaymentIntent` のステータスが 3 分後に `processing` から `succeeded` に遷移します。 | | `pm_ideal_generatedSepaDebitIntentsFail` | `PaymentIntent` のステータスが `processing` から `requires_payment_method` に遷移します。 | | `pm_ideal_generatedSepaDebitIntentsFailDelayed` | `PaymentIntent` のステータスが 3 分後に `processing` から `requires_payment_method` に遷移します。 | | `pm_ideal_generatedSepaDebitIntentsSucceedDisputed` | `PaymentIntent` のステータスが `processing` から `succeeded` に遷移しますが、不審請求の申し立てがすぐに作成されます。 | | `pm_ideal_generatedSepaDebitIntentsFailsDueToInsufficientFunds` | `PaymentIntent` のステータスが `processing` から `requires_payment_method` に遷移し、`insufficient_funds` のエラーコードが返されます。 | ## Optional: 設定後のイベントを処理する SetupIntent が完成すると、Stripe は [setup_intent.succeeded](https://docs.stripe.com/api/events/types.md#event_types-setup_intent.succeeded) イベントを送信します。ダッシュボード、カスタム *Webhook* (A webhook is a real-time push notification sent to your application as a JSON payload through HTTPS requests)、またはパートナーソリューションを使用してこれらのイベントを受信して、生成された SEPA ダイレクトデビット *PaymentMethod* (PaymentMethods represent your customer's payment instruments, used with the Payment Intents or Setup Intents APIs) をデータベースに保存したり、トライアル期間の終了後に顧客に請求するなどのアクションを実行します。 クライアントからのコールバックを待つのではなく、これらのイベントをリッスンします。クライアント側では、コールバックが実行される前に顧客がブラウザーのウィンドウを閉じたり、アプリを終了したりする可能性があります。また、悪意を持つクライアントがレスポンスを不正操作する恐れもあります。非同期型のイベントをリッスンするよう構築済みのシステムを設定することで、これ以降はより多くの決済手段を簡単に受け付けられるようになります。[サポートされているすべての決済手段の違い](https://stripe.com/payments/payment-methods-guide)をご確認ください。 ### イベントを受信し、ビジネスアクションを実行する #### 手動 Stripe ダッシュボードを使用して、Stripe のすべての支払いの確認、メール領収書の送信、入金処理、失敗した支払いの再試行を実行します。 - [ダッシュボードでテスト支払いを確認する](https://dashboard.stripe.com/test/payments) #### カスタムコード Webhook ハンドラを構築してイベントをリッスンし、非同期型のカスタムの決済フローを作成します。Stripe CLI を使用して、ローカルで Webhook の組み込みのテストとデバッグを行います。 - [カスタム webhook を構築](https://docs.stripe.com/webhooks/handling-payment-events.md#build-your-own-webhook) #### 事前構築のアプリ [オートメーション](https://stripe.partners/?f_category=automation)や[マーケティングとセールス](https://stripe.partners/?f_category=marketing-and-sales)などの一般的なビジネスイベントを、パートナーアプリケーションとの連携によって処理します。 # React Native > This is a React Native for when payment-ui is mobile and platform is react-native. View the full page at https://docs.stripe.com/payments/ideal/set-up-payment?payment-ui=mobile&platform=react-native. アプリで iDEAL | Wero を使用して将来の SEPA ダイレクトデビット決済を設定するには、プロセスを追跡するための [SetupIntent](https://docs.stripe.com/api/setup_intents.md) を作成し、同意書の確認を収集して、顧客を iDEAL | Wero にリダイレクトします。Stripe は `SetupIntent` を使用して、セットアップが完了するまでのすべての状態を追跡および処理します。 ## Stripe を設定する [サーバ側] [クライアント側] ### サーバ側 この組み込みには、Stripe API と通信するエンドポイントがサーバ上に必要です。Stripe の公式ライブラリを使用して、サーバから Stripe API にアクセスします。 #### Ruby ```bash # Available as a gem sudo gem install stripe ``` ```ruby # If you use bundler, you can add this line to your Gemfile gem 'stripe' ``` ### クライアント側 [React Native SDK](https://github.com/stripe/stripe-react-native) はオープンソースであり、詳細なドキュメントが提供されています。内部では、[ネイティブの iOS](https://github.com/stripe/stripe-ios) および [Android](https://github.com/stripe/stripe-android) の SDK を使用します。Stripe の React Native SDK をインストールするには、プロジェクトのディレクトリーで (使用するパッケージマネージャーによって異なる) 次のいずれかのコマンドを実行します。 #### yarn ```bash yarn add @stripe/stripe-react-native ``` #### npm ```bash npm install @stripe/stripe-react-native ``` 次に、その他の必要な依存関係をインストールします。 - iOS の場合は、**ios** ディレクトリに移動して `pod install` を実行し、必要なネイティブ依存関係もインストールします。 - Android の場合は、依存関係をインストールする必要はありません。 > [公式の TypeScript ガイド](https://reactnative.dev/docs/typescript#adding-typescript-to-an-existing-project)に従って TypeScript のサポートを追加することをお勧めします。 ### Stripe の初期化 React Native アプリで Stripe を初期化するには、決済画面を `StripeProvider` コンポーネントでラップするか、`initStripe` 初期化メソッドを使用します。`publishableKey` の API [公開可能キー](https://docs.stripe.com/keys.md#obtain-api-keys)のみが必要です。次の例は、`StripeProvider` コンポーネントを使用して Stripe を初期化する方法を示しています。 ```jsx import { useState, useEffect } from 'react'; import { StripeProvider } from '@stripe/stripe-react-native'; function App() { const [publishableKey, setPublishableKey] = useState(''); const fetchPublishableKey = async () => { const key = await fetchKey(); // fetch key from your server here setPublishableKey(key); }; useEffect(() => { fetchPublishableKey(); }, []); return ( {/* Your app code here */} ); } ``` > テストおよび開発時には API の[テストキー](https://docs.stripe.com/keys.md#obtain-api-keys)を使用し、アプリの公開時には[本番環境](https://docs.stripe.com/keys.md#test-live-modes)キーを使用します。 ## 顧客を作成または取得する [サーバー側] > #### Accounts v2 API を使用した顧客の表現 > > Accounts v2 API では、Connect ユーザーには一般提供され、その他の Stripe ユーザーには公開プレビューで提供されます。Accounts v2 プレビューの一部である場合は、コードで[プレビューバージョン](https://docs.stripe.com/api-v2-overview.md#sdk-and-api-versioning)を指定する必要があります。 > > Accounts v2 プレビューへのアクセスをリクエストするには、 > > ほとんどのユースケースでは、[Customer](https://docs.stripe.com/api/customers.md) オブジェクトを使用するのではなく、[顧客を顧客設定済みの Account オブジェクトとしてモデル化する](https://docs.stripe.com/accounts-v2/use-accounts-as-customers.md)ことをお勧めします。 顧客がビジネスでアカウントを作成するとき、または決済手段を保存するときに、顧客設定の [Account](https://docs.stripe.com/api/v2/core/accounts/create.md#v2_create_accounts-configuration-customer) または [Customer](https://docs.stripe.com/api/customers/create.md) を作成する。オブジェクトの ID を、顧客を表す独自の内部表現に関連付ける。 この決済に関連付ける新しい顧客を作成するか、既存の顧客を取得する。 #### Accounts v2 ```curl curl -X POST https://api.stripe.com/v2/core/accounts \ -H "Authorization: Bearer <>" \ -H "Stripe-Version: 2026-04-22.preview" \ --json '{ "contact_email": "jenny.rosen@example.com", "display_name": "Jenny Rosen", "configuration": { "customer": {} }, "include": [ "configuration.customer" ] }' ``` #### Customers v1 ```curl curl https://api.stripe.com/v1/customers \ -u "<>:" \ -d "name=Jenny Rosen" \ --data-urlencode "email=jenny.rosen@example.com" ``` ## SetupIntent を作成する [サーバー側] 顧客の ID を使用して `SetupIntent` を作成し、`ideal` を [payment_method_types](https://docs.stripe.com/api/setup_intents/create.md#create_setup_intent-payment_method_types) 配列に追加します。`SetupIntent` はセットアッププロセスの手順を追跡します。iDEAL | Wero の場合、これには顧客から [SEPA ダイレクトデビットの同意書](https://www.europeanpaymentscouncil.eu/what-we-do/sepa-direct-debit/sdd-mandate) を取得し、その有効性を追跡することが含まれます。 #### Accounts v2 ```curl curl https://api.stripe.com/v1/setup_intents \ -u "<>:" \ -d "payment_method_types[]=ideal" \ -d "customer_account={{CUSTOMERACCOUNT_ID}}" ``` #### Customers v1 ```curl curl https://api.stripe.com/v1/setup_intents \ -u "<>:" \ -d "payment_method_types[]=ideal" \ -d customer={{CUSTOMER_ID}} ``` ## 支払い方法の詳細と同意書承認を収集する [クライアント側] アプリで顧客の氏名、メールアドレス、および[銀行名](https://docs.stripe.com/api/payment_methods/object.md#payment_method_object-ideal-bank) (`abn_amro` など) を収集します。 ```javascript export default function IdealPaymentScreen() { const [name, setName] = useState(); const [bankName, setBankName] = useState(); const [email, setEmai] = useState(); const handlePayPress = async () => { // ... }; return ( setEmail(value.nativeEvent.text)} /> setName(value.nativeEvent.text)} /> setBankName(value.nativeEvent.text)} /> ); } ``` SEPA ダイレクトデビットの支払いを処理するには、顧客から同意書を収集する必要があります。以下に示す定型の承認用文書を表示し、顧客が黙示的にこの同意書に署名するようにしてください。 「Rocket Rides」はお客様の社名に置き換えます。 #### de Durch Angabe Ihrer Zahlungsinformationen und der Bestätigung der vorliegenden Zahlung ermächtigen Sie (A) und Stripe, unseren Zahlungsdienstleister, Ihrem Kreditinstitut Anweisungen zur Belastung Ihres Kontos zu erteilen, und (B) Ihr Kreditinstitut, Ihr Konto gemäß diesen Anweisungen zu belasten. Im Rahmen Ihrer Rechte haben Sie, entsprechend den Vertragsbedingungen mit Ihrem Kreditinstitut, Anspruch auf eine Rückerstattung von Ihrem Kreditinstitut. Eine Rückerstattung muss innerhalb von 8 Wochen ab dem Tag, an dem Ihr Konto belastet wurde, geltend gemacht werden. Eine Erläuterung Ihrer Rechte können Sie von Ihrem Kreditinstitut anfordern. Sie erklären sich einverstanden, Benachrichtigungen über künftige Belastungen bis spätestens 2 Tage vor dem Buchungsdatum zu erhalten. #### en By providing your payment information and confirming this payment, you authorise (A) and Stripe, our payment service provider, to send instructions to your bank to debit your account and (B) your bank to debit your account in accordance with those instructions. As part of your rights, you’re entitled to a refund from your bank under the terms and conditions of your agreement with your bank. A refund must be claimed within 8 weeks starting from the date on which your account was debited. Your rights are explained in a statement that you can obtain from your bank. You agree to receive notifications for future debits up to 2 days before they occur. #### es Al proporcionar sus datos de pago y confirmar este pago, usted autoriza a (A) y Stripe, nuestro proveedor de servicios de pago, a enviar instrucciones a su banco para realizar un débito en su cuenta y (B) a su banco a realizar un cargo en su cuenta de conformidad con dichas instrucciones. Como parte de sus derechos, usted tiene derecho a un reembolso de su banco conforme a los términos y condiciones del contrato con su banco. El reembolso debe reclamarse en un plazo de 8 semanas a partir de la fecha en la que se haya efectuado el cargo en su cuenta. Sus derechos se explican en un extracto que puede obtener en su banco. Usted acepta recibir notificaciones de futuros débitos hasta 2 días antes de que se produzcan. #### fi Antamalla maksutiedot ja vahvistamalla tämän maksun, valtuutat (A) ja Stripen, maksupalveluntarjoajamme, lähettämään ohjeet pankille tilisi veloittamiseksi ja (B) pankkisi veloittamaan tiliäsi kyseisten ohjeiden mukaisesti. Oikeuksiesi mukaisesti olet oikeutettu maksun palautukseen pankilta, kuten heidän kanssaan tekemässäsi sopimuksessa ja sen ehdoissa on kuvattu. Maksun palautus on lunastettava 8 viikon aikana alkaen päivästä, jolloin tiliäsi veloitettiin. Oikeutesi on selitetty pankilta saatavissa olevassa lausunnossa. Hyväksyt vastaanottamaan ilmoituksia tulevista veloituksista jopa kaksi päivää ennen niiden tapahtumista. #### fr En fournissant vos informations de paiement et en confirmant ce paiement, vous autorisez (A) et Stripe, notre prestataire de services de paiement et/ou PPRO, son prestataire de services local, à envoyer des instructions à votre banque pour débiter votre compte et (B) votre banque à débiter votre compte conformément à ces instructions. Vous avez, entre autres, le droit de vous faire rembourser par votre banque selon les modalités et conditions du contrat conclu avec votre banque. La demande de remboursement doit être soumise dans un délai de 8 semaines à compter de la date à laquelle votre compte a été débité. Vos droits sont expliqués dans une déclaration disponible auprès de votre banque. Vous acceptez de recevoir des notifications des débits à venir dans les 2 jours précédant leur réalisation. #### it Fornendo i dati di pagamento e confermando il pagamento, l’utente autorizza (A) e Stripe, il fornitore del servizio di pagamento locale, a inviare alla sua banca le istruzioni per eseguire addebiti sul suo conto e (B) la sua banca a effettuare addebiti conformemente a tali istruzioni. L’utente, fra le altre cose, ha diritto a un rimborso dalla banca, in base a termini e condizioni dell’accordo sottoscritto con l’istituto. Il rimborso va richiesto entro otto settimane dalla data dell’addebito sul conto. I diritti dell’utente sono illustrati in una comunicazione riepilogativa che è possibile richiedere alla banca. L’utente accetta di ricevere notifiche per i futuri addebiti fino a due giorni prima che vengano effettuati. #### nl Door je betaalgegevens door te geven en deze betaling te bevestigen, geef je (A) en Stripe, onze betaaldienst, toestemming om instructies naar je bank te verzenden om het bedrag van je rekening af te schrijven, en (B) geef je je bank toestemming om het bedrag van je rekening af te schrijven conform deze aanwijzingen. Als onderdeel van je rechten kom je in aanmerking voor een terugbetaling van je bank conform de voorwaarden van je overeenkomst met de bank. Je moet terugbetalingen binnen acht weken claimen vanaf de datum waarop het bedrag is afgeschreven van je rekening. Je rechten worden toegelicht in een overzicht dat je bij de bank kunt opvragen. Je gaat ermee akkoord meldingen te ontvangen voor toekomstige afschrijvingen tot twee dagen voordat deze plaatsvinden. 支払い方法を設定すると、承認済みの同意書が作成されます。これらの規約を受け入れる際、顧客は黙示的に同意書に署名したため、フォームまたはメールを通じて、顧客にこれらの規約を伝える必要があります。 ## Stripe に支払い方法の詳細を送信する [クライアント側] 作成した SetupIntent から client secret を取得し、`confirmSetupIntent` をコールします。これにより、Webview が表示され、顧客は銀行の Web サイトまたはアプリで設定を完了できます。完了後、SetupIntent の結果によって Promise が解決されます。 ```javascript export default function IdealPaymentScreen() { const [name, setName] = useState(); const [bankName, setBankName] = useState(); const [email, setEmai] = useState(); const handlePayPress = async () => { const billingDetails: PaymentMethodCreateParams.BillingDetails = { name: 'Jenny Rosen', email: 'jenny.rosen@example.com', }; }; const { error, setupIntent } = await confirmSetupIntent(clientSecret, { paymentMethodType: 'Ideal', paymentMethodData: { billingDetails, bankName, } }); if (error) { Alert.alert(`Error code: ${error.code}`, error.message); } else if (setupIntent) { Alert.alert( 'Success', `Setup intent created. Intent status: ${setupIntent.status}` ); } return {/* ... */}; } ``` ## 後日 SEPA ダイレクトデビット PaymentMethod に請求する 顧客に再度請求する必要が生じたときは、新しい PaymentIntent を作成します。SetupIntent を[取得](https://docs.stripe.com/api/setup_intents/retrieve.md)し、`latest_attempt` フィールドを[展開](https://docs.stripe.com/api/expanding_objects.md)して `payment_method_details` 内の `generated_sepa_debit` ID を探すことで、SEPA ダイレクトデビットの決済手段の ID を見つけます。 ```curl curl -G https://api.stripe.com/v1/setup_intents/{{SETUP_INTENT_ID}} \ -u "<>:" \ -d "expand[]=latest_attempt" ``` SEPA ダイレクトデビット ID と顧客の ID を使用して、`PaymentIntent` を作成します。 #### Accounts v2 ```curl curl https://api.stripe.com/v1/payment_intents \ -u "<>:" \ -d "payment_method_types[]=sepa_debit" \ -d amount=1099 \ -d currency=eur \ -d "customer_account={{CUSTOMERACCOUNT_ID}}" \ -d payment_method={{SEPA_DEBIT_PAYMENT_METHOD_ID}} \ -d confirm=true ``` #### Customers v1 ```curl curl https://api.stripe.com/v1/payment_intents \ -u "<>:" \ -d "payment_method_types[]=sepa_debit" \ -d amount=1099 \ -d currency=eur \ -d "customer={{CUSTOMER_ID}}" \ -d payment_method={{SEPA_DEBIT_PAYMENT_METHOD_ID}} \ -d confirm=true ``` ## 導入をテストする [テスト API キー](https://docs.stripe.com/keys.md#test-live-modes)を使用して SetupIntent を確定します。確定すると、決済手段の設定を承認または失敗させるオプションのあるテストページにリダイレクトされます。 - **Authorize test payment (テスト支払いをオーソリする)** をクリックして、設定成功のケースをテストします。SetupIntent が `requires_action` から `succeeded` に変わります。 - **Fail test payment (テスト支払いを失敗させる)** をクリックして、顧客が認証に失敗するケースをテストします。SetupIntent が `requires_action` から `requires_payment_method` に変わります。 ### SEPA ダイレクトデビット組み込みのテスト #### メール `payment_method.billing_details.email` を以下のいずれかの値に設定して、`PaymentIntent` のステータス遷移をテストしてください。任意のテキストとアンダースコアをメールアドレスの前に追加することもできます。例えば、`test_1_generatedSepaDebitIntentsFail@example.com` を使用すると、`PaymentIntent` で使用した際に必ず失敗する SEPA ダイレクトデビットの PaymentMethodになります。 | メールアドレス | 説明 | | ------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------- | | `generatedSepaDebitIntentsSucceed@example.com` | `PaymentIntent` のステータスが `processing` から `succeeded` に遷移します。 | | `generatedSepaDebitIntentsSucceedDelayed@example.com` | `PaymentIntent` のステータスが 3 分後に `processing` から `succeeded` に遷移します。 | | `generatedSepaDebitIntentsFail@example.com` | `PaymentIntent` のステータスが `processing` から `requires_payment_method` に遷移します。 | | `generatedSepaDebitIntentsFailDelayed@example.com` | `PaymentIntent` のステータスが 3 分後に `processing` から `requires_payment_method` に遷移します。 | | `generatedSepaDebitIntentsSucceedDisputed@example.com` | `PaymentIntent` のステータスが `processing` から `succeeded` に遷移しますが、不審請求の申し立てがすぐに作成されます。 | | `generatedSepaDebitIntentsFailsDueToInsufficientFunds@example.com` | `PaymentIntent` のステータスが `processing` から `requires_payment_method` に遷移し、`insufficient_funds` のエラーコードが返されます。 | #### PaymentMethod これらの PaymentMethods を使用して `PaymentIntent` のステータスの遷移をテストしてください。これらのトークンは、自動化されたテストで PaymentMethod がサーバー上の SetupIntent にすぐに関連付けられる際に役に立ちます。 | 決済手段 | 説明 | | --------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | | `pm_ideal_generatedSepaDebitIntentsSucceed` | `PaymentIntent` のステータスが `processing` から `succeeded` に遷移します。 | | `pm_ideal_generatedSepaDebitIntentsSucceedDelayed` | `PaymentIntent` のステータスが 3 分後に `processing` から `succeeded` に遷移します。 | | `pm_ideal_generatedSepaDebitIntentsFail` | `PaymentIntent` のステータスが `processing` から `requires_payment_method` に遷移します。 | | `pm_ideal_generatedSepaDebitIntentsFailDelayed` | `PaymentIntent` のステータスが 3 分後に `processing` から `requires_payment_method` に遷移します。 | | `pm_ideal_generatedSepaDebitIntentsSucceedDisputed` | `PaymentIntent` のステータスが `processing` から `succeeded` に遷移しますが、不審請求の申し立てがすぐに作成されます。 | | `pm_ideal_generatedSepaDebitIntentsFailsDueToInsufficientFunds` | `PaymentIntent` のステータスが `processing` から `requires_payment_method` に遷移し、`insufficient_funds` のエラーコードが返されます。 | ## Optional: 設定後のイベントを処理する SetupIntent が完成すると、Stripe は [setup_intent.succeeded](https://docs.stripe.com/api/events/types.md#event_types-setup_intent.succeeded) イベントを送信します。ダッシュボード、カスタム *Webhook* (A webhook is a real-time push notification sent to your application as a JSON payload through HTTPS requests)、またはパートナーソリューションを使用してこれらのイベントを受信して、生成された SEPA ダイレクトデビット *PaymentMethod* (PaymentMethods represent your customer's payment instruments, used with the Payment Intents or Setup Intents APIs) をデータベースに保存したり、トライアル期間の終了後に顧客に請求するなどのアクションを実行します。 クライアントからのコールバックを待つのではなく、これらのイベントをリッスンします。クライアント側では、コールバックが実行される前に顧客がブラウザーのウィンドウを閉じたり、アプリを終了したりする可能性があります。また、悪意を持つクライアントがレスポンスを不正操作する恐れもあります。非同期型のイベントをリッスンするよう構築済みのシステムを設定することで、これ以降はより多くの決済手段を簡単に受け付けられるようになります。[サポートされているすべての決済手段の違い](https://stripe.com/payments/payment-methods-guide)をご確認ください。 ### イベントを受信し、ビジネスアクションを実行する #### 手動 Stripe ダッシュボードを使用して、Stripe のすべての支払いの確認、メール領収書の送信、入金処理、失敗した支払いの再試行を実行します。 - [ダッシュボードでテスト支払いを確認する](https://dashboard.stripe.com/test/payments) #### カスタムコード Webhook ハンドラを構築してイベントをリッスンし、非同期型のカスタムの決済フローを作成します。Stripe CLI を使用して、ローカルで Webhook の組み込みのテストとデバッグを行います。 - [カスタム webhook を構築](https://docs.stripe.com/webhooks/handling-payment-events.md#build-your-own-webhook) #### 事前構築のアプリ [オートメーション](https://stripe.partners/?f_category=automation)や[マーケティングとセールス](https://stripe.partners/?f_category=marketing-and-sales)などの一般的なビジネスイベントを、パートナーアプリケーションとの連携によって処理します。 ## Optional: ディープリンクを処理する 顧客がアプリを終了すると (Safari やバンキングアプリで認証するなど)、自動的にアプリに戻るための方法を提供します。多くの決済手段タイプで、戻り先 URL の指定が「必須」です。戻り先 URL を有効にしていても、指定がされていないと、戻り先 URL が必要な決済手段をユーザーに提示できません。 戻り先 URL を指定するには、以下のようにします。 1. カスタム URL を[登録](https://developer.apple.com/documentation/xcode/defining-a-custom-url-scheme-for-your-app#Register-your-URL-scheme)します。ユニバーサルリンクはサポートされていません。 1. カスタム URL を[設定](https://reactnative.dev/docs/linking) します。 1. 以下のように、URL を Stripe SDK に転送するようにルートコンポーネントを設定します。 > Expo を使用している場合は、`app.json` ファイルで[スキームを設定](https://docs.expo.io/guides/linking/#in-a-standalone-app)します。 ```jsx import { useEffect, useCallback } from 'react'; import { Linking, View } from 'react-native'; import { useStripe } from '@stripe/stripe-react-native'; export default function MyApp() { const { handleURLCallback } = useStripe(); const handleDeepLink = useCallback( async (url: string | null) => { if (url) { const stripeHandled = await handleURLCallback(url); if (stripeHandled) { // This was a Stripe URL - you can return or add extra handling here as you see fit } else { // This was NOT a Stripe URL – handle as you normally would } } }, [handleURLCallback] ); useEffect(() => { const getUrlAsync = async () => { const initialUrl = await Linking.getInitialURL(); handleDeepLink(initialUrl); }; getUrlAsync(); const deepLinkListener = Linking.addEventListener( 'url', (event: { url: string }) => { handleDeepLink(event.url); } ); return () => deepLinkListener.remove(); }, [handleDeepLink]); return ( ); } ``` ネイティブ URL スキームの詳細については、[Android](https://developer.android.com/training/app-links/deep-linking) および [iOS](https://developer.apple.com/documentation/xcode/allowing_apps_and_websites_to_link_to_your_content/defining_a_custom_url_scheme_for_your_app) のドキュメントをご覧ください。 ## See also - [SEPA ダイレクトデビット決済を受け付ける](https://docs.stripe.com/payments/sepa-debit/accept-a-payment.md) - [EU での SEPA ダイレクトデビットによるサブスクリプションを設定する](https://docs.stripe.com/billing/subscriptions/sepa-debit.md)