Collect customer detailsBeta
Collect email addresses, physical addresses, and other customer details.
Billing addresses
By default, Checkout collects the minimal billing details required for payment through the Payment Element.
Using Address Element
You can collect complete billing addresses using the Address Element.
First, pass billing_address_collection=required when you create the Checkout Session.
Using a custom form
You can build your own form to collect billing addresses.
- If your checkout page has a distinct address collection step before confirmation, call updateBillingAddress when your customer submits the address.
- Otherwise, you can submit the address when your customer clicks the “pay” button by passing billingAddress to confirm.
Collect partial billing addresses
To collect partial billing addresses, such as just the country and postal code, pass billing_address_collection=auto.
When collecting partial billing addresses, you must collect addresses manually. By default, Payment Element is configured to automatically collect the minimal billing details required for payment. To avoid double collection of billing details, pass fields.billingDetails=never when creating the Payment Element. If you only intend to collect a subset of billing details (such as the customer’s name), pass never
for only the fields you intend to collect yourself.
Shipping addresses
To collect a customer’s shipping address, pass the shipping_address_collection parameter when you create the Checkout Session.
When you collect a shipping address, you must also specify which countries to allow shipping to. Configure the allowed_countries property with an array of two-letter ISO country codes property with an array of two-letter ISO country codes.
Using Address Element
You can collect complete shipping addresses with the Address Element.
Using a custom form
You can build your own form to collect shipping addresses.
- If your checkout page has a distinct address collection step before confirmation, call updateShippingAddress when your customer submits the address.
- Otherwise, you can submit the address when your customer clicks the “pay” button by passing shippingAddress to confirm.