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

注

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

ACH ダイレクトデビットによる将来の支払いに備えて詳細を保存する

将来の ACH ダイレクトデビットによる支払いに備えて支払い方法の詳細を保存する方法を紹介します。

ページをコピー

You can use the Setup Intents API to collect payment method details in advance, with the final amount or payment date determined later. This is useful for:

  • Saving payment methods to a wallet to streamline future purchases
  • Collecting surcharges after fulfilling a service
  • Starting a free trial for a subscription

注

ACH Direct Debit is a delayed notification payment method, which means that funds aren’t immediately available after payment. A payment typically takes 4 business days to arrive in your account.

Stripe を設定する
サーバ側
クライアント側

サーバ側

この組み込みには、Stripe API と通信するエンドポイントがサーバ上に必要です。Stripe の公式ライブラリを使用して、サーバから Stripe API にアクセスします。

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'

クライアント側

React Native SDK はオープンソースであり、詳細なドキュメントが提供されています。内部では、ネイティブの iOS および Android の SDK を使用します。Stripe の React Native SDK をインストールするには、プロジェクトのディレクトリーで (使用するパッケージマネージャーによって異なる) 次のいずれかのコマンドを実行します。

Command Line
yarn add @stripe/stripe-react-native

次に、その他の必要な依存関係をインストールします。

  • iOS の場合は、ios ディレクトリーに移動して pod install を実行し、必要なネイティブ依存関係もインストールします。
  • Android の場合は、依存関係をインストールする必要はありません。

Stripe の初期化

React Native アプリで Stripe を初期化するには、決済画面を StripeProvider コンポーネントでラップするか、initStripe 初期化メソッドを使用します。publishableKey の API 公開可能キーのみが必要です。次の例は、StripeProvider コンポーネントを使用して Stripe を初期化する方法を示しています。

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 ( <StripeProvider publishableKey={publishableKey} merchantIdentifier="merchant.identifier" // required for Apple Pay urlScheme="your-url-scheme" // required for 3D Secure and bank redirects > // Your app code here </StripeProvider> ); }

注

Use your API test keys while you test and develop, and your live mode keys when you publish your app.

顧客を作成または取得する
推奨
サーバー側

ユーザーがビジネスでアカウントを作成する際に、Customer オブジェクトを作成するか、このユーザーに関連付けられた既存の Customer を取得します。この Customer オブジェクトの ID を、顧客を表す社内の内部表記と関連付けることで、保存されている支払い方法の詳細を後で取得して使用することができます。Financial Connections のリピートユーザーの最適化を有効にするには、Customer にメールアドレスを含めます。

Command Line
cURL
curl https://api.stripe.com/v1/customers \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -d email={{CUSTOMER_EMAIL}}

SetupIntent を作成する
サーバー側

A SetupIntent is an object that represents your intent to set up a customer’s payment method for future payments. The SetupIntent tracks the steps of this set-up process.

Create a SetupIntent on your server with payment_method_types set to us_bank_account and specify the Customer’s id.

サーバー側

Create a SetupIntent on your server with payment_method_types set to us_bank_account and specify the Customer’s id.

Financial Connections 手数料の詳細については、料金体系の詳細をご覧ください。

デフォルトでは、銀行口座の支払い情報の収集では、手動の口座番号入力と少額入金の確認のフォールバックオプションを使用し、Financial Connections で顧客のアカウントを即時確認します。Financial Connections を設定し、ACH の実装を最適化するために追加の口座データにアクセスする方法については、Financial Connections に関するドキュメントをご覧ください。たとえば、Financial Connections を使用して、ACH 決済の開始前にアカウントの残高を確認できます。

注

顧客がアカウントを認証した後で、追加データにアクセスを拡張するには、権限を拡張してアカウントを再度関連付ける必要があります。

Command Line
cURL
curl https://api.stripe.com/v1/setup_intents \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -d customer={{CUSTOMER_ID}} \ -d "payment_method_types[]"=us_bank_account \ -d "payment_method_options[us_bank_account][financial_connections][permissions][]"=payment_method \ -d "payment_method_options[us_bank_account][financial_connections][permissions][]"=balances

クライアント側

SetupIntent には client secret が含まれています。これを React Native アプリで使用することで、SetupIntent オブジェクト全体を渡すことなく安全に支払いプロセスを完了できます。アプリで、サーバーの SetupIntent をリクエストし、その client secret を保存します。

function PaymentScreen() { // ... const fetchIntentClientSecret = async () => { const response = await fetch(`${API_URL}/create-intent`, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ // This is an example request body, the parameters you pass are up to you customer: '<CUSTOMER_ID>', }), }); const {clientSecret} = await response.json(); return clientSecret; }; return <View>...</View>; }

支払い方法の詳細を収集する
クライアント側

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

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

Use collectBankAccountForSetup to collect bank account details, create a PaymentMethod, and attach that PaymentMethod to the SetupIntent. You must include the account holder’s name in the billingDetails parameter to create an ACH Direct Debit PaymentMethod.

import {collectBankAccountForSetup} from '@stripe/stripe-react-native'; export default function MyPaymentScreen() { const [name, setName] = useState(''); const handleCollectBankAccountPress = async () => { // Fetch the intent client secret from the backend. // See `fetchIntentClientSecret()`'s implementation above. const {clientSecret} = await fetchIntentClientSecret(); const {setupIntent, error} = await collectBankAccountForSetup( clientSecret, { paymentMethodType: 'USBankAccount', payment_method_data: { billing_details: { name: "John Doe", }, }, }, ); if (error) { Alert.alert(`Error code: ${error.code}`, error.message); } else if (setupIntent) { Alert.alert('Setup status:', setupIntent.status); if (setupIntent.status === SetupIntents.Status.RequiresConfirmation) { // The next step is to call `confirmSetup` } else if (setupIntent.status === SetupIntents.Status.RequiresAction) { // The next step is to call `verifyMicrodepositsForSetup` } } }; return ( <PaymentScreen> <TextInput placeholder="Name" onChange={(value) => setName(value.nativeEvent.text)} /> <Button onPress={handleCollectBankAccountPress} title="Collect bank account" /> </PaymentScreen> ); }

これにより、銀行口座の詳細の収集と確認を処理するモーダル UI が読み込まれます。処理が完了すると、PaymentMethod が SetupIntent に自動的に関連付けられます。

戻り先 URL を設定する (iOS のみ)
クライアント側

顧客が Safari や銀行アプリで認証するなどしてアプリを終了した際に、後で自動的にアプリに戻るための方法を提供します。多くの支払い方法タイプでは戻り先 URL が必須であるため、貴社で支払い方法を有効にしていても、URL を指定していない場合、Stripe ではユーザーにその支払い方法を提示することはできません。

To provide a return URL:

  1. Register a custom URL. Universal links aren’t supported.
  2. Configure your custom URL.
  3. Set up your root component to forward the URL to the Stripe SDK as shown below.

注

Expo を使用している場合は、app.json ファイルでスキームを設定します。

App.tsx
import React, { useEffect, useCallback } from 'react'; import { Linking } 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 ( <View> <AwesomeAppComponent /> </View> ); }

ネイティブ URL スキームの詳細については、Android および iOS のドキュメントをご覧ください。

オプションFinancial Connections 銀行口座のデータにアクセスする
サーバー側

同意書承認を収集し送信する
クライアント側

SetupIntent を完了して顧客の支払い方法の詳細を保存する前に、同意書の規約を表示して顧客から承認を得る必要があります。

To comply with Nacha rules, you must obtain authorization from your customer before you can initiate payment by displaying mandate terms for them to accept. For more information on mandates, see Mandates.

顧客が同意書の規約を承認する際に、お客様は SetupIntent を確定する必要があります。confirmSetup を使用して、インテントを確定します。

import {confirmSetup} from '@stripe/stripe-react-native'; export default function MyPaymentScreen() { const [name, setName] = useState(''); const handleCollectBankAccountPress = async () => { // See above }; const handlePayPress = async () => { // use the same clientSecret as earlier, see above const {error, setupIntent} = await confirmSetup(clientSecret, { type: 'USBankAccount', }); if (error) { Alert.alert(`Error code: ${error.code}`, error.message); } else if (setupIntent) { if (setupIntent.status === SetupIntents.Status.Processing) { // The debit has been successfully submitted and is now processing } else if ( setupIntent.status === SetupIntents.Status.RequiresAction && setupIntent?.nextAction?.type === 'verifyWithMicrodeposits' ) { // The payment must be verified with `verifyMicrodepositsForPayment` } else { Alert.alert('Payment status:', setupIntent.status); } } }; return ( <PaymentScreen> <TextInput placeholder="Name" onChange={(value) => setName(value.nativeEvent.text)} /> <Button onPress={handleCollectBankAccountPress} title="Collect bank account" /> <Button onPress={handlePayPress} title="Pay" /> </PaymentScreen> ); }

成功した場合、Stripe から以下のいずれかのステータスで SetupIntent オブジェクトが返されます。

ステータス説明次のステップ
Succeeded銀行口座が即座に確認されたか、確認が必要ありませんでした。アクションは不要です
RequiresAction銀行口座を確認するには、さらにアクションを実行する必要があります。Step 6: Verifying bank accounts with microdeposits

After successfully confirming the SetupIntent, an email confirmation of the mandate and collected bank account details must be sent to your customer. Stripe handles these by default, but you can choose to send custom notifications if you prefer.

少額入金で銀行口座を確認する
クライアント側

すべての顧客が銀行口座を即座に確認できるとは限りません。このような場合、Stripe は少額入金を銀行口座に送金します。この入金は、1 ~ 2 営業日後に顧客のオンライン明細書に表示されます。入金は以下の 2 つのいずれかの形式で行われます。

  • 明細書表記コード。Stripe は、SM で始まる一意の 6 桁の descriptorCode を使用し、0.01 USD の 1 件の少額入金を顧客の銀行口座に送金します。顧客は、この文字列を使用して銀行口座を確認します。
  • 金額。Stripe は、ACCTVERIFY という明細書表記を使用し、一意でない 2 件の少額入金を顧客の銀行口座に送金します。顧客は、この入金額を使用して銀行口座を確認します。

前のステップで行った confirmSetup メソッドの呼び出しの結果として、requiresAction ステータスの SetupIntent が返される場合、SetupIntent には、確認を完了するための有益な情報を含む next_action フィールドが含まれています。

nextAction: { type: 'verifyWithMicrodeposits'; redirectUrl: "https://payments.stripe.com/…", microdepositType: "descriptor_code"; arrivalDate: "1647586800"; }

請求書メールを指定した場合、Stripe はこのメールで入金の到着予定日を顧客に通知します。このメールには、Stripe がオンラインで提供する確認ページへのリンクが含まれ、顧客はそのページで入金額を確認して銀行口座の確認を完了させることができます。

警告

確認の失敗は、明細書表記ベースの少額入金の場合は 10 回、金額ベースの少額入金の場合は 3 回までです。この上限を超えると、Stripe は銀行口座を確認できなくなります。また、少額入金の確認は 10 日経過するとタイムアウトになります。この期間内に少額入金を確認できなかった場合、PaymentIntent は新しい支払い方法の詳細を要求する状態に戻ります。少額入金とは何か、どのように使用されるのかを顧客に明確に伝えることで、確認に関する問題を回避できます。

支払いが requiresAction 状態であり、nextAction のタイプが verifyWithMicrodeposits であることを確認できる場合は、2 つの方法で銀行口座の確認を完了できます。

  1. 明細書表記コードまたは金額を収集した後、verifyMicrodepositsForSetup を呼び出して、入金をアプリで直接確認します。
import { verifyMicrodepositsForSetup } from '@stripe/stripe-react-native'; export default function MyPaymentScreen() { const [verificationText, setVerificationText] = useState(''); return ( <TextInput placeholder="Descriptor code or comma-separated amounts" onChange={(value) => setVerificationText(value.nativeEvent.text)} // Validate and store your user's verification input /> <Button title="Verify microdeposit" onPress={async () => { const { paymentIntent, error } = await verifyMicrodepositsForSetup(secret, { // Provide either the descriptorCode OR amounts, not both descriptorCode: verificationText, amounts: verificationText, }); if (error) { Alert.alert(`Error code: ${error.code}`, error.message); } else if (paymentIntent) { Alert.alert('Payment status:', paymentIntent.status); } }} /> ); }
  1. Stripe が自動的にオンラインで提供する確認ページを使用します。そのためには、nextAction オブジェクトの nextAction[redirectUrl] URL (上記を参照) を使用し、顧客に確認プロセスを完了するよう指示します。
const {error, setupIntent} = await confirmSetup(clientSecret, { type: 'USBankAccount', }); if (error) { Alert.alert(`Error code: ${error.code}`, error.message); } else if (setupIntent) { if ( setupIntent.status === SetupIntents.Status.RequiresAction && setupIntent?.nextAction?.type === 'verifyWithMicrodeposits' ) { // Open the Stripe-hosted verification page Linking.openURL(setupIntent.nextAction.redirectUrl); } else { Alert.alert('Payment status:', setupIntent.status); } }

銀行口座の確認に成功すると、Stripe は SetupIntent オブジェクトを Succeeded の status で返し、setup_intent.succeeded Webhook イベントを送信します。

確認が失敗する原因はいくつか存在します。失敗は直接的なエラー応答として同期的に発生することも、setup_intent.setup_failed Webhook イベントを通じて非同期で発生することもあります (以下の例を参照してください)。

{ "error": { "code": "payment_method_microdeposit_verification_amounts_mismatch", "message": "The amounts provided do not match the amounts that were sent to the bank account. You have {attempts_remaining} verification attempts remaining.", "type": "invalid_request_error" } }
エラーコード同期または非同期メッセージステータスの変化
payment_method_microdeposit_failed同期、または Webhook イベントを通じて非同期で発生少額入金に失敗しました。指定した銀行口座、金融機関、支店の番号を確認してくださいstatus は requires_payment_method で、last_setup_error が設定されます。
payment_method_microdeposit_verification_amounts_mismatch同期指定された金額が銀行口座に送金された金額と一致しません。確認試行の残り回数はあと {attempts_remaining} 回です。変化なし
payment_method_microdeposit_verification_attempts_exceeded同期、または Webhook イベントを通じて非同期で発生許容された確認の試行回数を超えましたstatus は requires_payment_method で、last_setup_error が設定されます。
payment_method_microdeposit_verification_timeoutWebhook イベントを通じて非同期で発生少額入金がタイムアウトになりました。顧客は要求された 10 日の期間内に銀行口座を確認しませんでした。status は requires_payment_method で、last_setup_error が設定されます。

組み込みをテストする

Financial Connections を使用して即時確認を行うシナリオをテストする方法をご紹介します。

Send transaction emails in a sandbox

After you collect the bank account details and accept a mandate, send the mandate confirmation and microdeposit verification emails in a sandbox. To do this, provide an email in the payment_method_data.billing_details[email] field in the form of {any-prefix}+test_email@{any_domain} when you collect the payment method details.

よくある間違い

You need to activate your Stripe account before you can trigger these emails while testing.

テスト用口座番号

Stripe では、手動入力の銀行口座の組み込みが本番環境に移行する準備が整ったかどうかを確認するため、テスト用の口座番号と対応するトークンをいくつか用意しています。

口座番号トークン金融番号動作
000123456789pm_usBankAccount_success110000000支払いは成功します。
000111111113pm_usBankAccount_accountClosed110000000口座が解約済みであるため、支払いは失敗します。
000111111116pm_usBankAccount_noAccount110000000口座が見つからないため、支払いは失敗します。
000222222227pm_usBankAccount_insufficientFunds110000000残高不足のため、支払いは失敗します。
000333333335pm_usBankAccount_debitNotAuthorized110000000引き落としがオーソリされていないため、支払いは失敗します。
000444444440pm_usBankAccount_invalidCurrency110000000通貨が無効であるため、支払いは失敗します。
000666666661pm_usBankAccount_failMicrodeposits110000000支払いで少額入金の送金が失敗します。
000555555559pm_usBankAccount_dispute110000000支払いによって不審請求の申請が開始されています。
000000000009pm_usBankAccount_processing110000000支払いは無期限に処理中のままになります。これは PaymentIntent のキャンセルをテストするのに便利です。
000777777771pm_usBankAccount_weeklyLimitExceeded110000000The payment fails due to payment amount causing the account to exceed its weekly payment volume limit.

テスト取引を完了する前に、自動的に支払いに成功または失敗するテスト用のすべての口座を確認する必要があります。確認するには、下記の少額入金のテスト用の金額または明細書表記コードを使用します。

少額入金の金額と明細書表記コードをテストする

さまざまなシナリオを再現するために、これらの少額入金の金額「または」明細書表記コードの値 0.01 を使用します。

少額入金の金額明細書表記コードの値 0.01シナリオ
32 および 45SM11AAアカウントの確認をシミュレーションします。
10 および 11SM33CC許容された確認回数の超過をシミュレーションします。
40 および 41SM44DD少額入金のタイムアウトをシミュレーションします。

Test settlement behavior

Test transactions settle instantly and are added to your available test balance. This behavior differs from livemode, where transactions can take multiple days to settle in your available balance.

将来の決済を受け付ける
サーバー側

When the SetupIntent succeeds, it creates a new PaymentMethod attached to a Customer. You can use these to initiate future payments without having to prompt the customer for their bank account a second time.

Command Line
curl
curl https://api.stripe.com/v1/payment_intents \ -u
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:
\ -d "amount"=1099 \ -d "currency"="usd" \ -d "customer"="{{CUSTOMER_ID}}" \ -d "payment_method"="{{PAYMENT_METHOD_ID}}" \ -d "payment_method_types[]"="us_bank_account" \ -d "confirm"="true"

オプション即時の確認のみ
サーバー側

オプション少額入金のみによる確認
サーバー側

オプションデフォルトの支払い方法を更新する
サーバー側

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