Skip to content
Create account
or
Sign in
The Stripe Docs logo
/
Ask AI
Create account
Sign in
Get started
Payments
Revenue
Platforms and marketplaces
Money management
Developer tools
Overview
About Stripe payments
Upgrade your integration
Payments analytics
Online payments
OverviewFind your use caseManaged Payments
Use Payment Links
Build a checkout page
    Overview
    Quickstarts
    Customize look and feel
    Collect additional information
      Collect physical addresses
      Charge for shipping
      Collect phone numbers
      Add custom fields
      Collect consent for promotional emails
    Collect taxes
    Dynamically update checkout
    Manage your product catalog
    Subscriptions
    Manage payment methods
    Let customers pay in their local currency
    Add discounts, upsells, and optional items
    Set up future payments
    Save payment details during payment
    Manually approve payments on your server
    After the payment
    Elements with Checkout Sessions API beta changelog
    Migrate from legacy Checkout
    Migrate Checkout to use Prices
Build an advanced integration
Build an in-app integration
Payment methods
Add payment methods
Manage payment methods
Faster checkout with Link
Payment interfaces
Payment Links
Checkout
Web Elements
In-app Elements
Payment scenarios
Custom payment flows
Flexible acquiring
Orchestration
In-person payments
Terminal
Other Stripe products
Financial Connections
Crypto
Climate
HomePaymentsBuild a checkout pageCollect additional information

Collect customer phone numbers

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

Copy page

You can enable phone number collection on all payment and subscription mode Checkout 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
Server-side

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

Command Line
cURL
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 \ -d ui_mode=custom \ --data-urlencode return_url="https://example.com/return"

Collect the customer's phone number
Client-side

Create a phone number input to collect your customer’s phone number. Call updatePhoneNumber when your customer finishes the input to save the phone number.

Depending on the design of your checkout form, you can call updatePhoneNumber in the following ways:

  • Directly before submitting the payment.
  • Before transitioning to the next step, such as clicking a Save button, if your form includes multiple steps.

You’re responsible for validating and formatting phone numbers before calling updatePhoneNumber.

index.html
<input type="tel" id="phone-number" />
checkout.js
stripe.initCheckout({fetchClientSecret}).then((checkout) => { const phoneNumberInput = document.getElementById('phone-number'); phoneNumberInput.addEventListener('blur', () => { checkout.updatePhoneNumber(phoneNumberInput.value); }); });

Retrieve the phone number
Server-side

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.
Was this page helpful?
YesNo
Need help? Contact Support.
Join our early access program.
Check out our changelog.
Questions? Contact Sales.
LLM? Read llms.txt.
Powered by Markdoc