購入に使用する決済手段を保存するベータ
将来の Checkout セッションでの再利用に備えて決済手段を保存する方法をご紹介します。
ベータ
Custom Checkout の導入はプライベートベータです。アクセスをリクエストするには、こちらをクリックしてください。
注
保存済みの決済手段の Custom Checkout のサポートには、カードのみが含まれます。銀行口座など、他の保存済みの決済手段はサポートされていません。
保存済みの決済手段を有効にする
Add an endpoint on your server that creates a Checkout Session object and set the ui_mode to custom
.
A Checkout Session represents your customer’s session as they pay for one-time purchases or subscriptions. Checkout Sessions expire 24 hours after creation. To allow a customer to save their payment method for future use, specify the saved_payment_method_options.payment_method_save parameter when creating the Checkout Session.
Saving a payment method requires a Customer. Pass an existing customer, or, to create a new customer, set the Checkout Session’s customer_creation to always
.
After you create the Checkout Session, use the client secret returned in the response to mount Elements.
同意を収集する
注意
Global privacy laws are complicated and nuanced. Before implementing the ability to store customer payment method details, work with your legal team to make sure that it complies with your privacy and compliance framework.
In most cases, you must collect a customer’s consent before you save their payment methods. The following example shows how to obtain consent using a checkbox.
Indicate to Stripe whether your customer has provided consent when you call confirm by passing the savePaymentMethod
parameter. When you save a customer’s payment details, you’re responsible for complying with all applicable laws, regulations, and network rules.
次のステップ
次に、決済フローで保存済みの決済手段を使用する方法をご紹介します。