DEV Community

mattling_dev for Stripe

Posted on • Updated on

Getting started with Stripe Tax

Stripe Tax

Calculating and collecting taxes is a complex task, and that complexity only increases as you grow your business and start selling to different markets that have complicated regulatory tax rules. As Kelly Moriarty recently explained, in the UK, a gingerbread man that’s wearing chocolate pants is taxed differently to one that isn’t.

That’s why we built and launched Stripe Tax. Stripe has abstracted away all of that complexity in to 3 simple configuration steps. In this article we’ll walk through those steps and show you how you can enable automatic tax calculation and collection for the countries where you have tax obligations.

Dashboard configuration

In order to get started with Stripe Tax, there are 3 simple dashboard configurations that you need to complete in the Stripe Tax settings section. It’s important to note that you won’t be charged for using Stripe Tax until you enable it for your transactions by setting automatic_tax[enabled] = true in Invoicing, Billing or Checkout or enabling tax calculation when creating a Payment Link.

1. Add your origin address

This is the address where your business is located or where your goods ship from.

Origin address

2. Add a default product tax code

This is the tax code of the kind of goods and services that you provide. There are a wide range of codes from subscriptions to hats. If you aren’t sure about which code to choose, consult with your tax advisor. Tax codes can also be applied on a per-product basis, but if a tax code is not set on a product, the default will be applied. In this case, I’m selling “Downloadable games”.

Default tax code

3. Create tax registrations

A registration is declaration for where you are registered to collect tax. Stripe Tax automatically surfaces potential registrations based on the transaction volume that you have processed in certain countries where you may have tax obligations. If you’re unsure as to where you have tax obligations, you can again consult with your tax advisor. Here, I’ve added VAT OSS in Ireland, which allows tax calculation and collection in all European countries.


Once you have completed these 3 steps, the final action is to enable tax calculation and collection when creating transactions. You will only then be charged once you have enabled that in Checkout, Invoicing, Billing or Payment Links.

Enabling tax calculation and collection

In this example, we’ll show how to enable tax calculation for a Checkout Session. In this particular scenario, we specify that the tax amount is inclusive when creating an ad-hoc price. You can also specify this when creating prices through the dashboard. That means that if a customer makes a purchase for 10 euros and the tax amount of 1 euro 87 cents is calculated (which we’ll see in the final screen), the amount the user pays is still 10 euros. If the tax behavior is exclusive, the final amount would be 11.87 euros. To enable automatic tax calculation and collection we simply specify automatic_tax[enabled] = true when creating the Checkout Session.

    require 'stripe'
    Stripe.api_key = '{{SECRET_KEY}}'

      automatic_tax: {
        enabled: true
      success_url: '',
      cancel_url: '',
      line_items: [
          price_data: {
            unit_amount: 1000,
            currency: 'eur',
            product_data: {
              name: 'Foobar'
            tax_behavior: 'inclusive',
          quantity: 1,
      mode: 'payment',
Enter fullscreen mode Exit fullscreen mode

When we redirect the customer to the hosted Checkout page, we can see that the tax amount was automatically calculated to the amount of 1 euro 87 cents.

Tax calculation


So now you are all set to automatically calculate and collect tax on your transactions on Stripe! To learn more, read the docs on Stripe Tax, and watch the accompanying video tutorials.

About the author

Matthew Ling

Matthew Ling (@mattling_dev) is a Developer Advocate at Stripe. Matt loves to tinker with new technology, adores Ruby and coffee and also moonlighted as a pro music photographer. His photo site is at and developer site is at

Stay connected

In addition, you can stay up to date with Stripe in a few ways:

📣 Follow us on Twitter
💬 Join the official Discord server
📺 Subscribe to our Youtube channel
📧 Sign up for the Dev Digest

Top comments (1)

maureensmith profile image

Does stripe automatically calculate sales tax? witch spells to make someone love you