Automatically collect tax on Checkout sessions
Learn how to automatically calculate taxes in Checkout.
Stripe Tax automatically calculates the taxes on all purchases and subscriptions accumulated during a Checkout session. If you haven’t integrated with Checkout, you must complete the integration using the Accept a Payment guide.
This video shows how to enable automatic tax collection when using hosted integrations like Stripe Checkout.
Create a Checkout Session
You can create Checkout sessions for one time and recurring purchases.
A customer’s tax rates come from their location, which Checkout assesses from the customer’s address. The address that Checkout uses to calculate taxes depends on whether the customer is new or existing, and whether you collect shipping addresses during the Checkout Session:
| New Customer | Existing Customer | |
|---|---|---|
| Collect a billing address only | Checkout calculates taxes based on the customer’s billing address entered into the Checkout Session | If the customer has a previously saved shipping address, Checkout calculates taxes based on that address. Otherwise, you can calculate taxes based on billing address entered during Checkout (by specifying customer_update[address]=auto) or the billing address saved to the customer (the default behaviour). |
| Collect a shipping address | Checkout calculates taxes based on the customer’s shipping address entered into the Checkout Session | Checkout calculates taxes based on the customer’s shipping address entered into the Checkout Session. Existing addresses on the customer won’t apply in this case. |
Note
To ensure that Google Pay is offered as a payment method while using Stripe Tax in Checkout, you must either require collecting a shipping address or provide an existing customer with a saved shipping address. Apple Pay with Stripe Tax displays only when the customer’s browser supports Apple Pay version 12 or greater.
Calculate tax for new customers
Set customer_ in the Checkout Session to create a Customer with collected billing and shipping addresses when not identifying an existing customer.
Checkout calculates the tax based on the location of the shipping address, if provided, or else the billing address.
Check the response
To inspect the results of the latest tax calculation, you can read the tax amount calculated by Checkout from the total_details.amount_tax on the Checkout Session resource. Additionally, the tax outcome for each payment is available when viewing a payment in the Dashboard.
OptionalUpdate your products and prices
Stripe Tax uses information stored on products and prices to calculate tax, such as tax code and tax behaviuor. If you don’t explicitly specify these configurations, Stripe Tax will use the default tax code selected in Tax Settings.
For more information, see Specify product tax codes and tax behaviour.
OptionalSpecifying tax codes when creating products inline
When creating a Checkout Session with line_items.price_data.product_data, you can specify a tax code directly in the request. We recommend you do this when you’re creating new products rather than using existing product IDs.
Replace txcd_ with the appropriate tax code for your product. The tax code determines how the product is categorised for tax purposes. If you don’t specify a tax code, Stripe Tax uses the default tax code from your Tax Settings.