调至内容部分
创建账户
或
登录
Stripe 文档徽标
/
询问人工智能
创建账户
登录
开始
付款
销售收入
平台和交易市场
资金管理
开发人员资源
概览
关于 Stripe 支付
升级您的集成
支付分析
线上付款
概览查找您的用例Managed Payments
使用 Payment Link
构建结账页面
    概览
    快速开始
    自定义外观样式
    收集额外信息
      收集物理地址
      收取运费
      收集电话号码
      添加自定义字段
      收集促销邮件通知许可
    收税
    动态更新结账流程
    管理产品目录
    订阅
    管理支付方式
    让客户用本地货币支付
    添加折扣、追加销售和可选商品
    设置未来付款
    支付过程中保存付款详情
    在您的服务器上手动批准支付
    付款后
    具有 Checkout Sessions API Beta 更改日志的 Element
    从传统 Checkout 迁移
    迁移 Checkout 来使用 Prices
构建高级集成
构建应用内集成
支付方式
添加支付方式
管理支付方式
用 Link 更快结账
支付接口
Payment Links
结账
Web Elements
应用内支付
支付场景
处理多种货币
自定义支付流程
灵活收单
编排
线下支付
Terminal
超越支付功能
成立公司
加密货币
Financial Connections
Climate
了解欺诈
Radar 欺诈保护
管理争议
验证身份
首页付款Build a checkout pageCollect additional information

Collect customer phone numbers

Collect a phone number for shipping or invoicing when your customer makes a payment.

You can enable phone number collection on all payment and subscription mode Sessions (phone number collection isn’t supported in setup mode). Only collect phone numbers if you need them for the transaction.

Enable phone number collection

To enable phone number collection, set phone_number_collection[enabled] to true when creating a Checkout Session.

Command Line
cURL
Stripe CLI
Ruby
Python
PHP
Java
Node.js
Go
.NET
No results
curl https://api.stripe.com/v1/checkout/sessions \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -d "line_items[0][price_data][unit_amount]"=1000 \ -d "line_items[0][price_data][product_data][name]"=T-shirt \ -d "line_items[0][price_data][currency]"=eur \ -d "line_items[0][quantity]"=2 \ -d "phone_number_collection[enabled]"=true \ -d mode=payment \ --data-urlencode success_url="https://example.com/success" \ --data-urlencode cancel_url="https://example.com/cancel"

With phone number collection enabled, Checkout adds a required phone number field to the payment form. If you’re collecting a shipping address, the phone number field displays under the address fields. Otherwise, Checkout displays the phone number field below the email input. Customers can only enter one phone number per session.

Retrieve the phone number

Phone number format

When your customer checks out with third-party wallets, such as Apple Pay or Google Pay, the phone number format isn’t guaranteed because of limitations on those platforms. We return the phone number value that’s provided by the third-party wallet.

We guarantee phone numbers in the E.164 format when a customer doesn’t use wallet payments.

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.

Collect phone numbers for existing customers

Passing in an existing Customer with a populated phone property to the Checkout Session results in the phone number field being prefilled.

If the customer updates their phone number, this updated value persists on the phone property on the Customer object , overwriting any previously saved phone number.

Update phone numbers with the customer portal

You can allow customers to manage their own accounts (which includes updating their phone numbers) in the customer portal.

另见

  • Integrate the customer portal
此页面的内容有帮助吗?
是否
  • 需要帮助?联系支持。
  • 加入我们的早期使用计划。
  • 查看我们的更改日志。
  • 有问题?联系销售。
  • LLM? Read llms.txt.
  • Powered by Markdoc