Skip to main content
RapidDev - Software Development Agency
stripe-guide

How to use Stripe Tax for automatic sales tax

Enable Stripe Tax to automatically calculate, collect, and report sales tax, VAT, and GST on your transactions. Activate Tax in the Dashboard, register your tax jurisdictions, and add automatic_tax to your PaymentIntents or Checkout Sessions. Stripe handles the rate calculations based on the customer's location.

What you'll learn

  • How to activate Stripe Tax and register tax jurisdictions
  • How to add automatic tax calculation to PaymentIntents and Checkout Sessions
  • How to set product tax codes for correct tax rates
  • How to access tax reports for filing
Book a free consultation
4.9Clutch rating
600+Happy partners
17+Countries served
190+Team members
Intermediate6 min read20 minutesStripe API 2024-12+, Node.js 18+, Stripe Tax supported countriesMarch 2026RapidDev Engineering Team
TL;DR

Enable Stripe Tax to automatically calculate, collect, and report sales tax, VAT, and GST on your transactions. Activate Tax in the Dashboard, register your tax jurisdictions, and add automatic_tax to your PaymentIntents or Checkout Sessions. Stripe handles the rate calculations based on the customer's location.

Automating Sales Tax Collection with Stripe Tax

Stripe Tax calculates the correct tax rate based on the product type and the customer's location, then collects and reports the tax for you. You activate it in the Dashboard, register the jurisdictions where you have tax obligations, and add a single automatic_tax parameter to your API calls. Stripe supports sales tax, VAT, and GST across 50+ countries.

Prerequisites

  • A Stripe account with Tax available in your country
  • Knowledge of where your business has tax obligations (nexus)
  • A working payment integration using PaymentIntents or Checkout Sessions
  • Products created in Stripe with appropriate tax codes

Step-by-step guide

1

Activate Stripe Tax in the Dashboard

Go to Stripe Dashboard → More → Tax. Complete the setup wizard: enter your business address (origin address for tax purposes) and confirm your preset tax behavior (exclusive or inclusive).

Expected result: Stripe Tax is activated and your origin address is configured.

2

Add tax registrations

In the Tax section, click 'Add registration'. Select each jurisdiction where you are registered to collect tax — for example, specific US states, EU countries for VAT, or countries for GST. Enter your registration number if required.

Expected result: Your tax registrations appear in the Tax → Registrations section of the Dashboard.

3

Set tax codes on your products

Each product in Stripe needs a tax code so Stripe Tax knows what rate to apply. Go to Products in the Dashboard and set the tax code, or set it via the API when creating products.

typescript
1const product = await stripe.products.create({
2 name: 'Pro Subscription',
3 tax_code: 'txcd_10103001' // Software as a Service (SaaS)
4});
5
6const price = await stripe.prices.create({
7 product: product.id,
8 unit_amount: 2500, // $25.00 in cents
9 currency: 'usd',
10 recurring: { interval: 'month' },
11 tax_behavior: 'exclusive' // tax added on top of price
12});

Expected result: Your product has a tax code assigned. Stripe will use this to determine the correct tax rate.

4

Add automatic_tax to Checkout Sessions

When creating a Checkout Session, set automatic_tax.enabled to true. Stripe will calculate the tax based on the customer's location and display it in the checkout.

typescript
1const session = await stripe.checkout.sessions.create({
2 mode: 'subscription',
3 line_items: [{
4 price: 'price_xxx',
5 quantity: 1
6 }],
7 automatic_tax: { enabled: true },
8 customer_update: {
9 address: 'auto' // collect address for tax calculation
10 },
11 success_url: 'https://example.com/success',
12 cancel_url: 'https://example.com/cancel'
13});

Expected result: The Checkout page shows the calculated tax amount based on the customer's location.

5

Add automatic_tax to PaymentIntents (custom flow)

If you use a custom payment form instead of Checkout, add automatic_tax to your PaymentIntent. You will need to provide the customer's address for tax calculation.

typescript
1const customer = await stripe.customers.create({
2 name: 'Jane Smith',
3 address: {
4 line1: '123 Main St',
5 city: 'San Francisco',
6 state: 'CA',
7 postal_code: '94105',
8 country: 'US'
9 }
10});
11
12const invoice = await stripe.invoices.create({
13 customer: customer.id,
14 automatic_tax: { enabled: true }
15});
16
17await stripe.invoiceItems.create({
18 customer: customer.id,
19 invoice: invoice.id,
20 price: 'price_xxx'
21});
22
23const finalizedInvoice = await stripe.invoices.finalizeInvoice(invoice.id);

Expected result: The invoice includes the calculated tax amount for the customer's jurisdiction.

6

Access tax reports

Go to Dashboard → Tax → Reports to view collected tax by jurisdiction. Use these reports for your tax filings. Stripe Tax also integrates with tax filing services.

Expected result: Tax reports show collected amounts broken down by jurisdiction, tax rate, and period.

Complete working example

stripe-tax-checkout.js
1// stripe-tax-checkout.js
2// Node.js Express server with Stripe Tax enabled
3
4const express = require('express');
5const Stripe = require('stripe');
6const stripe = Stripe(process.env.STRIPE_SECRET_KEY);
7const app = express();
8
9app.use(express.json());
10
11// Create a product with tax code
12app.post('/api/create-product', async (req, res) => {
13 try {
14 const product = await stripe.products.create({
15 name: req.body.name,
16 tax_code: 'txcd_10103001' // SaaS
17 });
18
19 const price = await stripe.prices.create({
20 product: product.id,
21 unit_amount: req.body.amount,
22 currency: 'usd',
23 tax_behavior: 'exclusive'
24 });
25
26 res.json({ product_id: product.id, price_id: price.id });
27 } catch (err) {
28 res.status(400).json({ error: err.message });
29 }
30});
31
32// Create Checkout Session with automatic tax
33app.post('/api/create-checkout', async (req, res) => {
34 try {
35 const session = await stripe.checkout.sessions.create({
36 mode: 'payment',
37 line_items: [{
38 price: req.body.price_id,
39 quantity: 1
40 }],
41 automatic_tax: { enabled: true },
42 success_url: `${req.headers.origin}/success?session_id={CHECKOUT_SESSION_ID}`,
43 cancel_url: `${req.headers.origin}/cancel`
44 });
45
46 res.json({ url: session.url });
47 } catch (err) {
48 res.status(400).json({ error: err.message });
49 }
50});
51
52// Retrieve tax details for a completed session
53app.get('/api/tax-details/:session_id', async (req, res) => {
54 try {
55 const session = await stripe.checkout.sessions.retrieve(
56 req.params.session_id,
57 { expand: ['total_details.breakdown'] }
58 );
59
60 res.json({
61 subtotal: session.amount_subtotal,
62 tax: session.total_details.amount_tax,
63 total: session.amount_total,
64 breakdown: session.total_details.breakdown
65 });
66 } catch (err) {
67 res.status(400).json({ error: err.message });
68 }
69});
70
71app.listen(3001, () => console.log('Server on port 3001'));

Common mistakes when using Stripe Tax for automatic sales tax

Why it's a problem: Not adding tax registrations before going live

How to avoid: Stripe Tax only calculates tax for jurisdictions where you have added a registration. Add all required registrations in Dashboard → Tax → Registrations.

Why it's a problem: Forgetting to set tax_behavior on prices

How to avoid: Each price needs tax_behavior set to 'exclusive' (tax added on top) or 'inclusive' (tax included in price). Without this, Stripe Tax cannot calculate correctly.

Why it's a problem: Not collecting the customer's address for tax calculation

How to avoid: Stripe Tax needs the customer's location. In Checkout, use customer_update.address: 'auto'. In custom flows, provide the address on the Customer object.

Why it's a problem: Using the wrong tax code for your product

How to avoid: Use Stripe's tax code reference to find the correct code. For example, txcd_10103001 is for SaaS, txcd_10000000 is for general digital goods.

Best practices

  • Set tax_behavior to 'exclusive' for B2B pricing and 'inclusive' for B2C pricing in regions that expect tax-inclusive prices
  • Use Stripe's tax code catalog to find the most specific code for your product category
  • Monitor the Tax → Overview page for threshold alerts in jurisdictions where you are approaching registration requirements
  • Test tax calculations in test mode — Stripe Tax works with test data
  • Download tax reports monthly and reconcile with your accounting software
  • For businesses with complex multi-jurisdiction tax obligations, RapidDev can help design the integration architecture
  • Set a default tax code at the account level for products you sell in a single category

Still stuck?

Copy one of these prompts to get a personalized, step-by-step explanation.

ChatGPT Prompt

I need to set up Stripe Tax to automatically calculate sales tax on my Stripe Checkout sessions. Show me how to create a product with a tax code, create a price with tax_behavior, and create a Checkout Session with automatic_tax enabled. Also show how to retrieve the tax breakdown after checkout.

Stripe Prompt

Set up a Node.js Express server that creates Stripe Checkout Sessions with automatic_tax enabled. Create products with the SaaS tax code (txcd_10103001), set exclusive tax behavior on prices, and add an endpoint to retrieve tax details after checkout completion.

Frequently asked questions

How much does Stripe Tax cost?

Stripe Tax costs 0.5% per transaction where tax is calculated. There is no monthly fee — you only pay when Stripe calculates tax on a transaction.

Does Stripe Tax file tax returns for me?

No. Stripe Tax calculates and collects tax, and provides reports. You still need to file returns yourself or use a tax filing service like TaxJar or Avalara.

Can I use Stripe Tax with custom payment forms (not Checkout)?

Yes. Use automatic_tax with Invoices or calculate tax with the Tax Calculations API. However, Checkout Sessions provide the simplest integration.

What countries does Stripe Tax support?

Stripe Tax supports tax calculation in 50+ countries including the US (state sales tax), EU (VAT), UK (VAT), Canada (GST/HST/PST), and Australia (GST).

What happens if a customer is in a jurisdiction where I am not registered?

Stripe Tax will not charge tax in jurisdictions where you have not added a registration. The transaction will be recorded for monitoring purposes to help you track when you approach nexus thresholds.

RapidDev

Talk to an Expert

Our team has built 600+ apps. Get personalized help with your project.

Book a free consultation

Need help with your project?

Our experts have built 600+ apps and can accelerate your development. Book a free consultation — no strings attached.

Book a free consultation

We put the rapid in RapidDev

Need a dedicated strategic tech and growth partner? Discover what RapidDev can do for your business! Book a call with our team to schedule a free, no-obligation consultation. We'll discuss your project and provide a custom quote at no cost.