顧客の電話番号を収集する
顧客が支払いを行うときに、配送や請求処理のために電話番号を収集します。
電話番号の収集は、payment
およびsubscription
環境の Checkout セッションで有効にできます (電話番号の収集は setup
モードではサポートされていません)。電話番号は、取引に必要な場合にのみ収集してください。
電話番号の収集を有効にするサーバー側
サーバー側
電話番号の収集を有効にするには、Checkout セッションを作成する際に、phone_number_collection[enabled] を true
に設定します。
電話番号を取得するサーバー側
サーバー側
After the session, you can retrieve customer phone numbers from the resulting Customer, or Checkout Session objects:
- On the Customer: Checkout saves collected phone numbers onto the phone property of the Customer object, which you can access programmatically by either fetching the Customer object directly with the API, or by listening for the customer.created event in a webhook. You can also view the customer’s phone number in the dashboard.
- On the Checkout Session: The customer’s phone number is also saved in the customer_details hash of the Checkout Session object, under customer_details.phone. After each successful Checkout Session, Stripe emits the checkout.session.completed event containing the Checkout Session object (and phone number), which you can listen for in a webhook.