Collect customer tax IDs with Checkout
Learn how to collect VAT and other customer tax IDs with Checkout.
Displaying a customer’s tax ID and legal business name on invoices is a common requirement that you can satisfy by enabling tax ID collection in Checkout. This guide assumes that you’ve already integrated Checkout. If you haven’t, see the Accept a payment guide.
Enable Tax ID collection
With tax ID collection enabled, Checkout shows and hides the tax ID collection form depending on your customer’s location. If your customer is in a location supported by tax ID collection, Checkout shows a tickbox allowing the customer to indicate that they’re purchasing as a business. When a customer ticks the box, Checkout displays fields for them to enter the tax ID and legal entity name for the business. If available, Checkout uses the customer’s shipping address to determine their location, otherwise Checkout uses the customer’s billing address. Customers can only enter one tax ID.
New Customers
To enable tax ID collection for new customers, set tax_id_collection[enabled] to true
when creating a Checkout session.
This example creates a Session in payment
mode with tax ID collection enabled. For subscriptions, make the same changes with the mode set to subscription
.
You can additionally configure Checkout to create a new Customer for you using customer_creation. If you do, Checkout saves any tax ID information collected during a Session to that new Customer. If not, the tax ID information will still be available at customer_details.tax_ids.
Existing Customers
If you pass an existing Customer when creating a Session, Checkout updates the Customer with any tax ID information collected during the Session. Checkout saves the collected business name onto the Customer’s name property, and adds the collected tax ID to the Customer’s customer.tax_ids array. Since the collection of a business name could result in the Customer’s existing name being overridden, you must set customer_update.name to auto
when creating the Session.
Caution
Checkout only collects tax IDs on Customer’s that don’t already have an existing tax ID. If a Customer has one or more tax IDs saved, Checkout doesn’t display the tax ID collection form even if tax ID collection is enabled.
When collecting tax IDs for existing customers you can either base their location on existing addresses on the customer or the addresses entered during checkout. By default, Checkout looks for existing addresses on the customer to assess their location:
If you don’t have the addresses of your existing customers saved, you can base their location on the billing or shipping address entered during Checkout. To specify that you want to use the billing address entered during Checkout to assess the customer’s location, you must set customer_update.address to auto
. When setting customer_update.address to auto
, Checkout replaces any previously saved addresses on the customer with the address entered during the session.
If you’re collecting shipping addresses for existing customers, you must base their location on the shipping address entered during checkout. To do so, set customer_update.shipping to auto
. When setting customer_update.shipping to auto
, Checkout replaces any previously saved shipping addresses on the customer with the shipping address entered during the session.
The above code example creates a Session in payment
mode with tax ID collection enabled. For subscriptions, make the same changes with the mode set to subscription
.
Retrieve Customer Tax ID details after a Session
Checkout includes provided tax IDs on the resulting Session object. After each completed Session, Checkout emits a checkout.session.completed event that you can listen for in a webhook endpoint. If you want to retrieve the collected tax ID from the Session object, it’s available under the Session’s customer_details.tax_ids array:
{ "object": { "id": "cs_test_a1dJwt0TCJTBsDkbK7RcoyJ91vJxe2Y", "object": "checkout.session", ... "customer": "cus_id_of_new_customer", "customer_details": { ... "tax_ids": [ { "type": "eu_vat", "value": "FRAB123456789" } ] }, ... "tax_id_collection": { "enabled": true }, ... } }
Checkout also saves collected tax IDs and business names to the Customer object if one is associated with the Session. A tax ID collected during checkout is accessible under the Customer’s customer.tax_ids array. You can also retrieve all tax IDs saved to a Customer with the Tax IDs resource by specifying the owner.type parameter to customer
and owner.customer to the Customer’s ID. Every new tax ID includes an associated legal business name, which Checkout saves to the Customer’s name property. In doing so, the collected legal business name is always visible on any subscription invoices for that Customer.
Test your integration
In test mode, you can enter any alphanumeric string that is in the correct format of a supported tax ID type (for example, DE123456789
for eu_
). For a full list of example tax IDs you can reference our Customer Tax ID guide. You can also use our test tax IDs to test various verification state flows.
Validation
Checkout performs checks during the Session to make sure that provided tax IDs are formatted correctly. We don’t verify that provided tax IDs are valid during the Session. You’re responsible for ensuring the validity of customer information collected during Checkout. To help, Stripe automatically performs asynchronous validation against government databases for Australian Business (ABN) numbers, European Value-Added-Tax (EU VAT) numbers, and United Kingdom Value-Added-Tax (GB VAT) numbers. You can read more on the validation we perform, and how to consume the status of those checks in our Customer Tax ID guide.
Supported Tax ID types
Checkout collects the following tax ID types in the given regions:
Country | Enum | Description | Example |
---|---|---|---|
Australia | au_ | Australian Business Number (AU ABN) | 12345678912 |
Austria | eu_ | European VAT number | ATU12345678 |
Bahrain | bh_ | Bahraini VAT Number | 123456789012345 |
Belarus | by_ | Belarus TIN Number | 123456789 |
Belgium | eu_ | European VAT number | BE0123456789 |
Bulgaria | eu_ | European VAT number | BG0123456789 |
Canada | ca_ | Canadian BN | 123456789 |
Canada | ca_ | Canadian GST/HST number | 123456789RT0002 |
Canada | ca_ | Canadian PST number (British Columbia) | PST-1234-5678 |
Canada | ca_ | Canadian PST number (Manitoba) | 123456-7 |
Canada | ca_ | Canadian PST number (Saskatchewan) | 1234567 |
Canada | ca_ | Canadian QST number (Québec) | 1234567890TQ1234 |
Chile | cl_ | Chilean TIN | 12.345.678-K |
Costa Rica | cr_ | Costa Rican tax ID | 1-234-567890 |
Croatia | eu_ | European VAT number | HR12345678912 |
Cyprus | eu_ | European VAT number | CY12345678Z |
Czech Republic | eu_ | European VAT number | CZ1234567890 |
Denmark | eu_ | European VAT number | DK12345678 |
Ecuador | ec_ | Ecuadorian RUC number | 1234567890001 |
Egypt | eg_ | Egyptian Tax Identification Number | 123456789 |
Estonia | eu_ | European VAT number | EE123456789 |
Finland | eu_ | European VAT number | FI12345678 |
France | eu_ | European VAT number | FRAB123456789 |
Georgia | ge_ | Georgian VAT | 123456789 |
Germany | eu_ | European VAT number | DE123456789 |
Greece | eu_ | European VAT number | EL123456789 |
Hungary | eu_ | European VAT number | HU12345678 |
Iceland | is_ | Icelandic VAT | 123456 |
India | in_ | Indian GST number | 12ABCDE3456FGZH |
Ireland | eu_ | European VAT number | IE1234567AB |
Italy | eu_ | European VAT number | IT12345678912 |
Kazakhstan | kz_ | Kazakhstani Business Identification Number | 123456789012 |
Kenya | ke_ | Kenya Revenue Authority Personal Identification Number | P000111111A |
Latvia | eu_ | European VAT number | LV12345678912 |
Liechtenstein | li_ | Liechtenstein VAT number | 12345 |
Lithuania | eu_ | European VAT number | LT123456789123 |
Luxembourg | eu_ | European VAT number | LU12345678 |
Malta | eu_ | European VAT number | MT12345678 |
Mexico | mx_ | Mexican RFC number | ABC010203AB9 |
Moldova | md_ | Moldova VAT Number | 1234567 |
Morocco | ma_ | Morocco VAT Number | 12345678 |
Netherlands | eu_ | European VAT number | NL123456789B12 |
New Zealand | nz_ | New Zealand GST number | 123456789 |
Nigeria | ng_ | Nigerian Tax Identification Number | 12345678-0001 |
Norway | no_ | Norwegian VAT number | 123456789MVA |
Oman | om_ | Omani VAT Number | OM1234567890 |
Poland | eu_ | European VAT number | PL1234567890 |
Portugal | eu_ | European VAT number | PT123456789 |
Romania | eu_ | European VAT number | RO1234567891 |
Russia | ru_ | Russian INN | 1234567891 |
Russia | ru_ | Russian KPP | 123456789 |
Saudi Arabia | sa_ | Saudi Arabia VAT | 123456789012345 |
Serbia | rs_ | Serbian PIB number | 123456789 |
Singapore | sg_ | Singaporean GST | M12345678X |
Slovakia | eu_ | European VAT number | SK1234567891 |
Slovenia | eu_ | European VAT number | SI12345678 |
South Africa | za_ | South African VAT number | 4123456789 |
South Korea | kr_ | Korean BRN | 123-45-67890 |
Spain | es_ | Spanish NIF number (previously Spanish CIF number) | A12345678 |
Spain | eu_ | European VAT number | ESA1234567Z |
Sweden | eu_ | European VAT number | SE123456789123 |
Switzerland | ch_ | Switzerland VAT number | CHE-123.456.789 MWST |
Taiwan | tw_ | Taiwanese VAT | 12345678 |
Tanzania | tz_ | Tanzania VAT Number | 12345678A |
Thailand | th_ | Thai VAT | 1234567891234 |
Turkey | tr_ | Turkish Tax Identification Number | 0123456789 |
Ukraine | ua_ | Ukrainian VAT | 123456789 |
United Arab Emirates | ae_ | United Arab Emirates TRN | 123456789012345 |
United Kingdom | eu_ | Northern Ireland VAT number | XI123456789 |
United Kingdom | gb_ | United Kingdom VAT number | GB123456789 |
Uzbekistan | uz_ | Uzbekistan TIN Number | 123456789 |
Uzbekistan | uz_ | Uzbekistan VAT Number | 123456789012 |