Collect taxes
Learn how to collect taxes with Stripe Tax.
Stripe Tax is a paid product that automatically calculates the tax on your transactions without the need to define the rates and rules. Fees only apply after you’ve added at least one location where you’re registered to calculate and remit tax.
Configure your Checkout Session to collect tax
To start collecting tax:
- Pass automatic_tax[enabled]=true.
- Specify a tax_code for each line item or set a preset tax code in the Dashboard.
- Specify a tax_behavior for each line item or set a default tax behavior in the Dashboard.
Tax codes
Tax codes associate products with tax rates. Choose the tax code that best fits your product from the list of available tax codes. If a product doesn’t fit any of the specific codes, use one of the codes with “General” in its name.
Tax behavior
The tax behavior determines how tax is presented to the buyer. There are two options for tax behavior:
- Exclusive: The product price doesn’t include tax. Tax is added as a separate amount.
- Inclusive: The product price includes any tax amount.
Learn more about tax behavior.
OptionalCollect tax through the Payment Element
You can collect tax address details directly in the Payment Element. Collecting tax address details through the Payment Element is suitable for the following use cases:
- You don’t require full address collection.
- You only require address collection for tax collection purposes.
This feature integrates input fields for the country and postal code into each payment method form within the Payment Element. It only collects the minimum required address fields for tax calculation based on Stripe Tax requirements.
There are certain regional considerations where the tax rate using the minimum required address fields might differ from the tax rate at your customer’s full address. We recommend using the Address Element to collect your customer’s full address for tax calculation if these regional considerations apply to your business.
When creating the Checkout Session, use the following parameters with the Checkout Sessions API:
- Set billing_address_collection=auto to automatically collect the billing address.
- Don’t include the shipping_address_collection parameter. If you provide this parameter, tax address details are collected based on the shipping address instead of the billing address.
When collecting tax address details through the Payment Element, tax calculation behaves as follows for the following scenarios:
- If fields.billingDetails.address=auto | if_required is passed, the Payment Element collects the minimum required address fields for tax calculation.
- If fields.billingDetails.address=never is passed, you must collect tax address details through an alternative method because the billing input fields won’t show in the Payment Element.
- If fields.billingDetails.address.country=never is passed, the customer’s detected country is used for tax calculation.
- If fields.billingDetails.address.postalCode=never is passed, an error is thrown because the postal code can be required for certain countries.
- If checkout.updateBillingAddress is called, an error is thrown because the billing address could potentially conflict.
OptionalCheck the response
To see the results of the latest tax calculation, the total_details.amount_tax property in the Checkout Session resource shows the calculated tax amount. Additionally, you can use the Dashboard to view the tax outcome for each payment.