コンテンツにスキップ
アカウントを作成
または
サインイン
Stripe ドキュメントのロゴ
/
AI に質問する
アカウントを作成
サインイン
始める
支払い
売上
プラットフォームおよびマーケットプレイス
資金管理
開発者向けのツール
概要
Billing
    概要
    Billing API について
    サブスクリプション
      サブスクリプションの仕組み
      クイックスタート
      ユースケース
      実装を構築
      サブスクリプション機能
        サブスクリプションの請求書
        サブスクリプションのスケジュール
        サブスクリプションの料金体系
        継続的な料金体系モデル
        料金表を埋め込む
        サブスクリプションを始める
        数量の設定
        請求サイクルの設定
        サブスクリプションの遡及適用
        複数のアイテムに登録
        トライアル期間を設定
        クーポンを適用
        サブスクリプションを Stripe に移行する
        クレジットの比例分配の計算方法
        サブスクリプションの決済
        サブスクリプションの決済手段
          ACH ダイレクトデビット
          Amazon Pay
          イギリスでの Bacs ダイレクトデビット
          銀行振込
          オーストラリアの BECS ダイレクトデビット
          Cash App Pay
          PayPal
          Revolut Pay
          韓国のカード
          カカオペイ
          Naver Pay
          カナダのプレオーソリデビット
          EU の SEPA ダイレクトデビット
          iDEAL と SEPA ダイレクトデビット
          Bancontact と SEPA ダイレクトデビット
        サードパーティーによる決済処理を導入
        回収方法
        強力な顧客認証 (SCA)
        サブスクリプションを管理
        サブスクリプションの修正
        保留中の更新の管理
      アナリティクス
    Invoicing
    従量課金
    Connect と Billing
    Tax と Billing
    見積もり
    売上回収
    オートメーション
    スクリプト
    収益認識
    顧客管理
    エンタイトルメント
    実装内容をテストする
税金
レポート機能
データ
スタートアップの企業設立
ホーム売上BillingSubscriptionsSubscription featuresSubscription payment methods

注

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

SEPA ダイレクトデビットによるサブスクリプションを設定する

SEPA ダイレクトデビットを使用したサブスクリプションの作成と請求の方法をご紹介します。

ページをコピー

SEPA ダイレクトデビットを使用したサブスクリプションの作成と請求の方法をご紹介します。

注

新しいユーザーの場合には、このガイドで説明されているように、Stripe Elements ではなく、Payment Element を使用してください。Payment Element は、コンバージョン最適化が組み込まれたローコードの導入パスを提供します。手順については、サブスクリプションの構築をご覧ください。

商品と価格を作成する
ダッシュボード

Products (商品) は、販売しているアイテムまたはサービスを表します。Prices (価格) は、商品の価格と請求頻度を定義します。これには、商品の価格、受け付ける通貨、および 1 回限りの支払いか継続支払いかが含まれます。商品と価格が数個のみの場合は、ダッシュボードでそれらを作成および管理します。

このガイドでは、例としてストックフォトサービスを使用し、15 EUR の月次サブスクリプションを顧客に請求します。これをモデル化するには、次のようにします。

  1. 商品を追加ページに移動します。
  2. 商品の名前を入力します。
  3. 価格に 15 を入力します。
  4. 通貨として EUR を選択します。
  5. 商品を保存をクリックします。

商品と価格を作成したら、価格 ID を記録しておき、後続のステップで使用できるようにします。ID は料金体系ページで price_G0FvDp6vZvdwRZ のように表示されます。

顧客を作成
サーバ側

サブスクリプションで支払い方法を再利用し、継続支払いを追跡するには、Customer (顧客) が必要になります。 顧客がビジネスでアカウントを作成する際に、Customer オブジェクトを作成します。

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

サブスクリプションを作成する
サーバ側

Create the subscription using the customer and price IDs. Return to the client side the client_secret from either the latest invoice’s confirmation_secret.client_secret or, for subscriptions that don’t collect a payment up front, the pending_setup_intent. Additionally, set:

  • payment_behavior を default_incomplete に設定して、SEPA ダイレクトデビットの同意書の回収を効率化します。
  • save_default_payment_method を on_subscription に設定して、支払いが完了したときの支払い方法をサブスクリプションのデフォルトとして保存します。デフォルトの支払い方法を保存すると、その後のサブスクリプションの決済の成功率が高くなります。
server.rb
Ruby
# Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys Stripe.api_key =
'sk_test_BQokikJOvBiI2HlWgH4olfQ2'
post '/create-subscription' do content_type 'application/json' data = JSON.parse(request.body.read) customer_id = cookies[:customer] price_id = data['priceId'] subscription = Stripe::Subscription.create( customer: customer_id, items: [{ price: price_id, }], payment_behavior: 'default_incomplete', payment_settings: {save_default_payment_method: 'on_subscription'}, expand: ['latest_invoice.confirmation_secret', 'pending_setup_intent'] ) if subscription.pending_setup_intent != nil { type: 'setup', clientSecret: subscription.pending_setup_intent.client_secret }.to_json else { type: 'payment', clientSecret: subscription.latest_invoice.confirmation_secret.client_secret }.to_json end end

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

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 への準拠が維持されます。スクリプトをバンドルに含めたり、そのコピーを自身でホストすることがないようにしてください。

payment_setup.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 Direct Debit mandate (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.

コピー

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

payment_setup.html
<form action="/form" method="post" id="setup-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 SetupIntent as a data attribute --> <button id="submit-button" data-secret="{CLIENT_SECRET}"> Set up SEPA Direct Debit </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 に支払い方法の詳細を送信する
クライアント側

confirmSepaDebitPayment を使用して、または前払いのないサブスクリプションの場合は confirmSepaDebitSetup を使用してサブスクリプションを確定し、SEPA ダイレクトデビットによる PaymentMethod を作成します。payment_method.billing_details プロパティに顧客の名前とメールアドレスを追加します。

PaymentSetup.js
// Define stripe with your publishable key var stripe = Stripe('pk_test_1234'); // Get the IBAN information from your element var iban = document.getElementById('iban-element'); const form = document.getElementById('payment-form'); const accountholderName = document.getElementById('accountholder-name'); const email = document.getElementById('email'); form.addEventListener('submit', async(event) => { event.preventDefault(); // Create the subscription const res = await fetch('/create-subscription', { method: 'POST', }); const {type, clientSecret} = await res.json(); const confirmIntent = type === 'setup' ? stripe.confirmSepaDebitSetup : stripe.confirmSepaDebitPayment; const {error} = await confirmIntent({ clientSecret, { payment_method: { sepa_debit: iban, billing_details: { name: accountholderName.value, email: email.value, }, }, } }); });

デフォルトの支払い方法を設定する
サーバ側

以降の支払いを成功させるには、格納された支払い方法を顧客に追加する必要があります。これを実行するには、先ほど収集した支払い方法を Customer オブジェクトの最上位レベルに設定し、請求書のデフォルトの支払い方法として設定します。

Command Line
cURL
curl https://api.stripe.com/v1/customers/cus_Gk0uVzT2M4xOKD \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -d "invoice_settings[default_payment_method]"=pm_1F0c9v2eZvKYlo2CJDeTrB4n

サブスクリプションステータスを管理する
クライアント側

初回の支払いが成功すると、サブスクリプションの状態は active になり、それ以上のアクションは不要です。支払いが失敗した場合は、ステータスが自動請求設定で設定されたサブスクリプションステータスに変わります。顧客に失敗を通知し、別の支払い方法で請求する必要があります。

注

SEPA ダイレクトデビット支払いは、他の支払い方法に再試行スケジュールが設定されている場合でも、自動的に再試行することはありません。

組み込みをテストする

組み込みのテストには、以下の IBAN を使用できます。各 IBAN に対応する支払い方法の詳細が収集されますが、支払い時にはそれぞれ異なる動作を示します。

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 エラーコードで失敗します。

オプション請求サイクルを設定する

オプションサブスクリプションのトライアル

オプション他の支払い方法を使用して SEPA ダイレクトデビット支払いを作成する

このページはお役に立ちましたか。
はいいいえ
お困りのことがございましたら 、サポートにお問い合わせください。
早期アクセスプログラムにご参加ください。
変更ログをご覧ください。
ご不明な点がございましたら、お問い合わせください。
LLM ですか?llms.txt を読んでください。
Powered by Markdoc