Collect shipping or billing informationBeta
Learn how to collect shipping or billing information with the Address Element.
Private preview
The Custom Checkout integration is in private preview. To request access, click here.
Enable address collection
Enable address collection when you create a Checkout Session:
- To enable shipping address collection when you create a Checkout Session, pass shipping_address_collection. Specify which countries to allow shipping to by configuring the allowed_countries property with an array of two-letter ISO country codes.
- To enable billing address collection when you create a Checkout Session, pass billing_address_collection=required.
Render an Address Element
The Address Element is an embeddable UI component for accepting complete addresses. Use it to collect shipping addresses, or when you need a complete billing address, such as for tax purposes.
You can collect both shipping and billing addresses by using multiple Address Elements on your page.
If you prefer to build your own address form, you can render a custom form for address collection.
OptionalUpdate an address manually
You can update billing or shipping information manually by setting updateBillingAddress or updateShippingAddress.
If you are rendering a custom address form, do not call these functions on every change. Instead, call the update functions after your customer has finished inputting the address (e.g. in response to a “save” button).