請求せずに直接保存
提示されたカードの詳細を収集して、オンライン利用のために保存します。
Use SetupIntents to collect card details without charging the card. A SetupIntent can’t save a card_
PaymentMethod directly, but in most cases you can create a reusable generated_
PaymentMethod that represents the same card. From your customer’s perspective, they’re the same payment method.
You can use SetupIntents to collect card details on Visa, Mastercard, American Express, Discover, and co-branded Interac, eftpos, and girocard cards. SetupIntents don’t support single-branded Interac, eftpos, and girocard cards.
注
For businesses in certain verticals, Stripe offers a limited private beta feature that allows you to save digital wallet payment methods. To request access, contact stripe-terminal-betas@stripe.com.
SetupIntents を使用してStripe Terminal でカードを保存するには、次のようにする必要があります。
- Customer オブジェクトを作成または取得します。
- プロセスを追跡する SetupIntent (支払い方法設定インテント) オブジェクトを作成します。
- 顧客の同意を収集してから、支払い方法を収集します。
- Stripe に支払い方法の詳細を送信します。
注
2024 年 10 月以降、Stripe では顧客の同意モデルを変更し、レガシーの customer_
パラメーターの代わりに allow_
パラメーターを使用するようにしました。組み込みで customer_
を使用している場合は、2025 年 3 月 31 日までに allow_
を使用するように更新する必要があります。ガイダンスについては、変更ログエントリーをご覧ください。
注
Your applications must be on version 2.
of the SDK to use SetupIntents. View our migration guide to learn more.
Create or retrieve a customer 
To charge a card saved with Stripe, you must attach it to a Customer.
When you include a customer in your SetupIntent before confirming, Stripe automatically attaches the generated card payment method to the Customer object you provide.
以下のコードをサーバーに含めて、新しい Customer
を作成します。
Create a SetupIntent 
注
We recommend providing a customer ID while creating a SetupIntent—doing so attaches the card payment method to the Customer
upon successful setup. If you don’t provide a customer ID, you must attach the payment method in a separate call.
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 setup process. For Terminal, this includes collecting and recording cardholder consent.
SetupIntent を作成して、customer
、onBehalfOf
(Connect の場合のみ)、usage
の各パラメーターを指定できます。
If the information required to start a payment isn’t readily available in your app, you can create the SetupIntent on your server. Use the client secret to call retrieveSetupIntent
, and, then use the retrieved SetupIntent to call collectSetupIntentPaymentMethod
.
Collect a payment method for saving 
After you create a SetupIntent, you need to collect a payment method using the SDK and collect customer consent. Pass allowRedisplay as always
or limited
, indicating the degree to which a payment method can be shown in a customer checkout flow.
After you create a SetupIntent, you need to collect a payment method with the SDK and collect customer consent. If the customer provides the required form of agreement or consent, set the customerConsentCollected
Boolean to true.
注
顧客からの同意を、文書またはアプリケーションのチェックボックスを使用して収集します。ご登録の地域で適用されるすべての法律、規則、および規制に準拠する必要があります。
支払い方法を収集するには、リーダーに接続する必要があります。アプリが collectSetupIntentPaymentMethod
を呼び出した後、接続されたリーダーはカードが提示されるのを待ちます。
この方法では、接続されたカードリーダーを使用して支払い方法の暗号化データを収集し、その暗号化データを SetupIntent に関連付けます。
注意
支払い方法の収集はローカルで行われ、次のステップまで SetupIntent オブジェクトのオーソリや更新は必要ありません。
Cancel collection 
Programmatic cancellation 
You can cancel collecting a payment method by using the Cancelable object returned by the SDK.
Customer-initiated cancellation
When you set setEnableCustomerCancellation to true for a transaction, smart reader users see a cancel button. Tapping the cancel button cancels the active transaction.
Submit the payment method details to Stripe 
confirmSetupIntent
を使用して、設定を完了させます。
A successful setup returns a succeeded
value for the SetupIntent’s status property, along with a SetupAttempt.payment_method_details.card_present.generated_card, which is a reusable card
payment method you can use for online payments.
注
The SetupIntent.payment_method is a card_
PaymentMethod that represents the tokenization of the physically present card and isn’t chargeable online. Future payments use the generated card instead. From the customer’s perspective, they’re the same payment method.
The generated_
payment method automatically attaches to the customer you provided during SetupIntent creation. You can retrieve the generated_
payment method by expanding the SetupIntent’s latest_
property. Always check for a generated_
value, because for payment methods that don’t allow generated cards, the value is empty.
別の方法として、顧客に関連付けられている支払い方法のリストを取得することで、関連付けられた支払い方法を入手することもできます。
SetupIntent の作成時に顧客を指定しなかった場合は、別個のコールで generated_
を Customer オブジェクトに関連付けることができます。
設定に失敗したら、返されたエラーを調べて原因を特定します。たとえば、顧客から同意を収集できなかったり、Stripe に顧客の同意を通知できなったりした場合、エラーが発生します。
Compliance
顧客の支払いの詳細を保存する際、適用されるすべての法律、規制、ネットワークの規則に準拠する責任はお客様にあります。たとえば、欧州データ保護委員会は、支払いの詳細の保存に関するガイダンスを発行しています。これらの要件は通常、以降の購入時の決済フローでの顧客の支払い方法を提示する、顧客がお客様のウェブサイトやアプリを使用していないときに請求するなど、将来に備えて顧客の支払い方法を保存する場合に適用されます。
支払い方法の詳細を保存する趣旨、顧客がオプトインできるようにする規約を、ウェブサイトおよびアプリに追加します。顧客がオフラインのときに顧客に請求する予定の場合は、少なくとも以下に関する説明を規約に含めてください。
- 指定された取引で顧客の代理として単独の支払いまたは一連の支払いを開始することをお客様に許可するという、顧客からお客様への同意
- 予期される支払い時期と支払い頻度 (たとえば、請求が予定されている分割払いまたはサブスクリプションの決済なのか、あるいは予定されていないトップアップなのか)。
- 決済金額の決定方法。
- サブスクリプションサービスに使用される支払い方法を設定する場合は、キャンセルに関するポリシー。
これらの規約に関する顧客の書面による同意の記録を必ず保管してください。
支払い方法を保存した場合、その使用は、規約に記載された特定の用途にのみ使用できます。顧客がオフラインであるときに請求し、さらに顧客の支払い方法を保存して、以降の購入に備えた保存済みの支払方法として顧客に提示する場合は、顧客から明示的に同意を収集する必要があります。そのための方法の 1 つとして、「今後の使用に備えて支払い方法を保存する」チェックボックスの使用があります。
デジタルウォレットを保存する
If your MCC is in one of the following ranges, you might be eligible to participate in a limited beta for saving digital wallet payment methods. For more details, contact stripe-terminal-betas@stripe.com.
- Car Rental Agencies (3351 - 3500)
- Lodging – Hotels, Motels, Resorts (3501 - 3999)
- Steamship and Cruise Lines (4411)
- Boat Rentals and Leasing (4457)
- Lodging - Hotels, Motels, Resorts, Central Reservations Services (Not Elsewhere Classified) (7011)
- Trailer Parks and Campgrounds (7033)
- Equipment, Tool, Furniture, and Appliance Rental and Leasing (7394)
- Car Rental Agencies (Not Elsewhere Classified) (7512)
- Truck and Utility Trailer Rentals (7513)
- Motor Home and Recreational Vehicle Rentals (7519)
When you save a digital wallet payment method, the generated_
has allow_
, because checkout flows are prohibited from presenting saved digital wallets as a payment option. You can only charge saved digital wallet payment methods for off_session payments.