コンテンツにスキップ
アカウントを作成
または
サインイン
Stripe ドキュメントのロゴ
/
AI に質問する
アカウントを作成
サインイン
始める
支払い
売上
プラットフォームおよびマーケットプレイス
資金管理
開発者向けのツール
概要
Stripe Payments について
構築済みのシステムをアップグレード
支払いの分析
オンライン決済
概要ユースケースを見つけるManaged Payments
Payment Links を使用する
決済ページを構築
高度なシステムを構築
アプリ内実装を構築
決済手段
決済手段を追加
    概要
    支払い方法の導入オプション
    ダッシュボードで支払い方法を管理
    決済手段のタイプ
    カード
    Stripe 残高で支払う
    仮想通貨
    銀行口座引き落とし
      ACH ダイレクトデビット
      Bacs ダイレクトデビット
      カナダのプレオーソリデビット
      オーストラリアの BECS ダイレクトデビット
      ニュージーランドの BECS ダイレクトデビット
      SEPA ダイレクトデビット
        決済を受け付ける
        銀行情報の保存
    銀行へのリダイレクト
    銀行振込
    クレジットトランスファー (Sources)
    後払い
    リアルタイム決済
    店舗支払い
    ウォレット
    国ごとに現地の支払い方法を有効化
    カスタムの決済手段
決済手段を管理
Link による購入の迅速化
支払いインターフェイス
Payment Links
Checkout
Web Elements
アプリ内 Elements
決済シナリオ
カスタムの決済フロー
柔軟なアクワイアリング
オーケストレーション
店頭支払い
端末
他の Stripe プロダクト
Financial Connections
仮想通貨
Climate
ホーム支払いAdd payment methodsBank debitsSEPA Direct Debit

注

このページはまだ日本語ではご利用いただけません。より多くの言語で文書が閲覧できるように現在取り組んでいます。準備が整い次第、翻訳版を提供いたしますので、もう少しお待ちください。

SEPA ダイレクトデビットによる支払いを受け付ける

SEPA ダイレクトデビット支払いの受け付けについて説明します。

ページをコピー

注

Stripe の債権者 ID を使用して SEPA ダイレクトデビット支払いを処理する場合は、構築済みの Checkout ページを使用して、SEPA ダイレクトデビットの同意書を収集することをお勧めします。

Web サイトでの SEPA ダイレクトデビット支払いの受け付けは、支払いを追跡するオブジェクトの作成、支払い方法に関する情報と同意書承認の収集、および支払いを処理するための Stripe への支払いの送信で構成されます。Stripe はこの PaymentIntent と呼ばれる支払いオブジェクトを使用して、支払いが完了するまで、支払いのすべての状態の追跡と処理を行います。

SEPA ダイレクトデビットの PaymentMethod は、顧客に Bancontact、iDEAL、または Sofort を使用した銀行情報の認証を依頼することによっても設定できます。

Stripe を設定する
サーバ側

まず、Stripe アカウントが必要です。今すぐ登録してください。

アプリケーションから Stripe API にアクセスするには、Stripe の公式ライブラリを使用します。

Command Line
Ruby
# Available as a gem sudo gem install stripe
Gemfile
Ruby
# If you use bundler, you can add this line to your Gemfile gem 'stripe'

Customer を作成または取得する
サーバ側

以降の支払いに SEPA ダイレクトデビットの口座を再利用するには、その口座を Customer に関連付ける必要があります。

顧客がお客様のビジネスでアカウントを作成する際、Customer オブジェクトを作成してください。この Customer オブジェクトの ID を、顧客を表す独自の内部表記と関連付けることで、保存した支払い方法の詳細を後で取得して使用することができます。

新しい Customer を作成するか、または既存の Customer を取得して、この支払いに関連付けます。サーバに以下のコードを含め、新しい Customer を作成します。

Command Line
cURL
curl -X POST https://api.stripe.com/v1/customers \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"

PaymentIntent を作成する
サーバ側

PaymentIntent (支払いインテント) は、顧客から支払いを回収する意図を表すオブジェクトであり、支払いプロセスのライフサイクルの各段階を追跡します。最初に、サーバーで PaymentIntent を作成し、回収する金額と eur 通貨を指定します (SEPA ダイレクトデビットは他の通貨には対応していません)。すでに Payment Intents API を使用したシステムがある場合は、sepa_debit を PaymentIntent の支払い方法タイプのリストに追加します。Customer の id を指定します。

再利用するために SEPA ダイレクトデビットの口座を保存するには、setup_future_usage パラメーターを off_session に設定します。SEPA ダイレクトデビットはこのパラメーターの値として off_session のみを受け付けます。

Command Line
curl
curl https://api.stripe.com/v1/payment_intents \ -u
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:
\ -d "amount"=1099 \ -d "currency"="eur" \ -d "setup_future_usage"="off_session" \ -d "customer"="{{CUSTOMER_ID}}" \ -d "payment_method_types[]"="sepa_debit" \ -d "metadata[integration_checker]"="sepa_debit_accept_a_payment"

支払い方法の詳細と同意書承認を収集する
クライアント側

Stripe Elements を使用してクライアントで支払い情報を収集する準備ができました。Elements は、支払いの詳細を収集するための構築済み UI コンポーネントのセットです。

Stripe Element には、HTTPS 接続を介して支払い情報を Stripe に安全に送信する iframe が含まれています。組み込みを機能させるには、決済ページのアドレスの先頭を http:// ではなく https:// にする必要があります。

HTTPS を使用せずに実装をテストできます。本番環境で決済を受け付ける準備が整ったら、HTTPS を有効化します。

Stripe Elements を設定する

Stripe Elements は Stripe.js の機能として自動的に使用可能になります。支払いページに Stripe.js スクリプトを含めるには、HTML ファイルの head にそのスクリプトを追加します。常に js.stripe.com から Stripe.js を直接読み込むことにより、PCI への準拠が維持されます。スクリプトをバンドルに含めたり、そのコピーを自身でホストすることがないようにしてください。

submit_payment.html
<head> <title>Submit Payment</title> <script src="https://js.stripe.com/v3/"></script> </head>

支払いページで、次の JavaScript を使用して Elements のインスタンスを作成します。

const stripe = Stripe(
'pk_test_TYooMQauvdEDq54NiTphI7jx'
); const elements = stripe.elements();

IBAN Element を追加して設定する

Elements には、決済フォーム内での配置場所が必要です。決済フォームで一意の ID を持つ空の DOM ノード (コンテナー) を作成します。また、顧客は SEPA ダイレクトデビット同意書を読み、同意する必要があります。

以下に示す定型の承認用文書を表示し、顧客が黙示的にこの同意書に署名するようにしてください。

「Rocket Rides」はお客様の社名に置き換えます。

Authorization text template

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 are 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.

コピー

支払い方法を設定するか、PaymentIntent を確定すると、承認済みの同意書が作成されます。顧客は黙示的に同意書に署名したため、フォームまたはメールを通じて、顧客にこれらの規約を伝える必要があります。

submit_payment.html
HTML
<form action="/charge" method="post" id="payment-form"> <div class="form-row inline"> <div class="col"> <label for="accountholder-name"> Name </label> <input id="accountholder-name" name="accountholder-name" placeholder="Jenny Rosen" required /> </div> <div class="col"> <label for="email"> Email Address </label> <input id="email" name="email" type="email" placeholder="jenny.rosen@example.com" required /> </div> </div> <div class="form-row"> <!-- Using a label with a for attribute that matches the ID of the Element container enables the Element to automatically gain focus when the customer clicks on the label. --> <label for="iban-element"> IBAN </label> <div id="iban-element"> <!-- A Stripe Element will be inserted here. --> </div> </div> <!-- Add the client_secret from the PaymentIntent as a data attribute --> <button id="submit-button" data-secret="{{CLIENT_SECRET}}">Submit Payment</button> <!-- Display mandate acceptance text. --> <div id="mandate-acceptance"> By providing your payment information and confirming this payment, you authorise (A) Rocket Rides and Stripe, our payment service provider and/or PPRO, its local 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 are 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. </div> <!-- Used to display form errors. --> <div id="error-message" role="alert"></div> </form>

フォームが読み込まれるときに、IBAN Element のインスタンスを作成し、それを Element コンテナーにマウントできます。

// Custom styling can be passed to options when creating an Element. const style = { base: { color: '#32325d', fontSize: '16px', '::placeholder': { color: '#aab7c4' }, ':-webkit-autofill': { color: '#32325d', }, }, invalid: { color: '#fa755a', iconColor: '#fa755a', ':-webkit-autofill': { color: '#fa755a', }, }, }; const options = { style, supportedCountries: ['SEPA'], // Elements can use a placeholder as an example IBAN that reflects // the IBAN format of your customer's country. If you know your // customer's country, we recommend passing it to the Element as the // placeholderCountry. placeholderCountry: 'DE', }; // Create an instance of the IBAN Element const iban = elements.create('iban', options); // Add an instance of the IBAN Element into the `iban-element` <div> iban.mount('#iban-element');

Stripe に支払いを送信する
クライアント側

PaymentIntent オブジェクト全体をクライアントに送信するのではなく、ステップ 3 の client secret を使用します。これは、Stripe API リクエストを認証する API キーとは異なります。

ただし、client secret は支払いを完了できるため、慎重に取り扱う必要があります。記録したり、URL に埋め込んだり、当該の顧客以外に漏洩することがないようにしてください。

ユーザーがフォームを送信したら、stripe.confirmSepaDebitPayment を使用して支払いを完了します。SEPA ダイレクトデビットの PaymentMethod を作成するには、payment_method パラメーターの billing_details プロパティーに顧客の氏名とメールアドレスを含める必要があります。また、IBAN に国コード AD、PF、TF、GI、GB、GG、VA、IM、JE、MC、NC、BL、PM、SM、CH、WF が含まれる場合は、billing_details.address プロパティーの、country と line1 のプロパティーが必要です。IBAN の国コードを取得するには、IBAN Element の change イベントをリッスンします。

const form = document.getElementById('payment-form'); const accountholderName = document.getElementById('accountholder-name'); const email = document.getElementById('email'); const submitButton = document.getElementById('submit-button'); const clientSecret = submitButton.dataset.secret; form.addEventListener('submit', (event) => { event.preventDefault(); stripe.confirmSepaDebitPayment( clientSecret, { payment_method: { sepa_debit: iban, billing_details: { name: accountholderName.value, email: email.value, }, }, } ); });

PaymentIntent の成功を確認する

SEPA ダイレクトデビットは、遅延通知型の支払い方法であるため、売上はすぐに利用可能にはなりません。支払いが正常に送信されると、PaymentIntent のステータスが requires_confirmation から processing に更新されます。支払いが成功すると、PaymentIntent のステータスが processing から succeeded に更新されます。

PaymentIntent のステータスが更新されると、以下のイベントが送信されます。

イベント説明次のステップ
payment_intent.processing顧客の支払いは、Stripe に正常に送信されました。開始された支払いの成功、または失敗の結果を待ちます。
payment_intent.succeeded顧客の決済が成功しました。顧客が購入した商品またはサービスのフルフィルメントを行います。
payment_intent.payment_failed顧客の支払いが拒否されました。Contact the customer through email or push notification and request another payment method.

支払いが成功したことを確認し、顧客に支払い完了を通知するには、Webhook を使用することをお勧めします。

setup_future_usage および customer が設定されているため、支払いが processing 状態になると、PaymentMethod が Customer オブジェクトに関連付けられることに注意してください。この関連付けは、支払いが最終的に成功するか、失敗するかには関係なく行われます。

組み込みをテストする

Stripe は、システムの本番環境への移行準備が整っているかを確認する際に使用できるテスト用の番号をいくつか用意しています。SEPA ダイレクトデビットを使用する Checkout システムをテストする際は、SEPA ダイレクトデビットのテスト用番号を使用できます。

IBAN をテストする
アカウント番号説明
IE29AIBK93115212345678PaymentIntent のステータスは、processing から succeeded に変化します。
IE24AIBK93115212345671The PaymentIntent status transitions from processing to succeeded after at least three minutes.
IE02AIBK93115212345679PaymentIntent のステータスは、processing から requires_payment_method に変化します。
IE94AIBK93115212345672The PaymentIntent status transitions from processing to requires_payment_method after at least three minutes.
IE51AIBK93115212345670PaymentIntent のステータスは、processing から succeeded に変化しますが、不審請求の申請が即座に作成されます。
IE10AIBK93115200343434支払金額がアカウントの週次支払い金額の上限を超えるため、支払いは charge_exceeds_source_limit エラーコードで失敗します。
IE69AIBK93115200121212支払い金額がアカウントの取引金額の上限を超えているため、支払いは charge_exceeds_weekly_limit エラーコードで失敗します。
IE10AIBK93115202222227支払いは insufficient_funds エラーコードで失敗します。

オプションIBAN Element を検証する

オプションConfigure customer debit date

オプションCustomize mandate references with a prefix

参照情報

  • 今後の支払いのために SEPA ダイレクトデビットの詳細を保存する
  • Connect での支払い
このページはお役に立ちましたか。
はいいいえ
お困りのことがございましたら 、サポートにお問い合わせください。
早期アクセスプログラムにご参加ください。
変更ログをご覧ください。
ご不明な点がございましたら、お問い合わせください。
LLM ですか?llms.txt を読んでください。
Powered by Markdoc