20
5 Comments

Stripe Tax - A Complete Guide

What does Stripe Tax do?

Stripe Tax is a new product that Stripe is offering which will allow for you to automatically collect taxes from your customers, based on where they are located.

On top of this, you will be able to see what countries you may be doing enough business to warrant tax collection in as well as offering an easy way to file/remit your taxes during tax time

In this guide we are going to go through how to configure Stripe Tax, and how to use the new APIs in order to start automatically collecting taxes.

Lets get to it!

1. Configuring Stripe Tax

The first thing you'll need to do to get started is enable Stripe Tax in your Stripe settings - once you do that you can start configuring Stripe Tax by entering your Origin Address (The place where your business is located) as well as your default tax code.

Where do you need to collect taxes?

Once you've set up your origin address you can start adding tax registration locations. Stripe Tax will automatically let you know potential locations you should start collecting taxes in based on the amount of sales you are doing in each country.

Stripe tax dash

Stripe will let you know what locations you are doing enough business in to warrant tax collection

Enabling VAT MOSS to allow collecting all EU VATs

While you can configure individual EU countries to have taxes enabled, if you enable "VAT MOSS" on a single EU location it will automatically collect the correct VAT amounts for ALL EU countries.

vat moss

Configuring Products/Prices

The final step to configuring Stripe Tax is to configure your products and prices.

Find the product you want to collect taxes on, and do these two things:

  1. Set a Tax Code on the product (this will override whatever default tax code you configured in the earlier step)

  2. Choose inclusive or exclusive taxes on the price within the product (required) - this will decide whether the taxes are baked into the original cost (inclusive) or added on top of the price (exclusive)

Once these steps are done, you can start collecting taxes automatically in your subscriptions and invoices.

If you want to see all these steps in video form, check it out here

2. Collecting Taxes Automatically

There are three ways to start using Stripe Tax to automatically collect taxes

  1. Manually creating subscriptions/invoices in the dashboard
  2. Using a no-code solution such as Billflow (embedded experience in your app) or Stripe Checkout (redirect user to a hosted Stripe page)
  3. Creating automatic-tax enabled subscriptions/invoices via Stripe's API

For 1 and 2 there is no development required, you just enable taxes and you'll be good to go. For option #3 we will need to get into the code and change the way we create subscriptions or invoices.

With the introduction of Stripe Tax - there is a new parameter called automatic_tax that exists on subscriptions and invoices.

auto tax

When this is enabled, taxes will automatically be collected on subscriptions or invoices that have properly configured prices - and that's really all there is to it!

Here's an example of creating an automatic_tax subscription using NodeJS:

const subscription = await stripe.subscriptions.create({
    customer: "cus_JakvIY69pk5F2t",//customer with billing address filled out
    automatic_tax: {
      enabled: true
    },
    items: [{
      price: "price_1IxZZgCw8NN4pRw7Lun2abu3"//stripe tax enabled price
    }],
    expand: ["latest_invoice"]})
console.log(`Customer paid a total of: ${subscription.latest_invoice.total}, customer paid taxes: ${subscription.latest_invoice.tax}`)

Every time the customer is charged via this subscription (or invoice), the correct tax rate will be applied based on where the customer's billing address is.

Here's a more comprehensive video on how to get this working with your SaaS

Show customers preview of tax payment before purchase

The last thing you'll need to do to get your Stripe Tax integration fully up and running is to integrate the automatic tax calculation feature with your checkout flow, which will let your end-customers see the total amount they will pay with taxes included based on their location.

To accomplish this, Stripe has provided a new way of using the "Upcoming Invoice" API.

In the past, upcoming invoices could only be generated for an existing customer or subscription, but now with Stripe Tax, this API is available to be used with only the customer location as a parameter (either address OR IP address)

In order to use this API correctly, you will need to develop a backend service which can be called by the front-end, collecting customer billing details/IP address as well as what type of plan they are checking out.

such a service will call the upcoming invoice API as so:

  automatic_tax: {
    enabled: true
  },
  customer_details: {
    //physical address overwrites the IP address for tax calculations
    address: {
      city: "Dublin",
      country: "IE",
      postal_code: "D02 H210",
      line1: "1 Grand Canal Street Lower, Grand Canal Dock"
    },
    tax: {
			//German IP, will show german VAT if address is not present
      ip_address: "178.239.198.5" 
    }
  },
  expand: [
    "total_tax_amounts.tax_rate"
  ],
  subscription_items: [
    {
      price: "price_1IxZZgCw8NN4pRw7Lun2abu3"
    }
  ]
}
const stripe = require("stripe")("rk_test_51IHb87Cw8NN4pRw7QwjhBZHTAiPA9kmp8y1WAJTGG2eSOgi5KpJCNyFZ60ZEREmAM4WZJqpJrTCJNom0356YBQ69004FPuSy4h")
const upcoming = await stripe.invoices.retrieveUpcoming(testPayload)
console.log(`Customer will pay a total of ${upcoming.total} (including taxes), taxes paid will be ${upcoming.tax}`)

In this example we have both address and IP address entered, in most cases when implementing this functionality - when a customer enters the checkout flow the IP address will be used to estimate their taxes, with the estimation service being called again once more address data is available (once checkout occurs and a subscription is created, the billing address will be the determinator of what tax rate they are assigned)

Here's the video explaining how this all works

Enabling Stripe Tax on existing subscriptions

Currently in order to move your existing subscriptions over to start collecting taxes automatically, you will need to write a basic migration script that will call the Stripe subscription update API and flip the automatic tax switch on each old subscription.

Here's a super basic example NodeJS script that does just that.

An assumption being made here that every price the subscriptions have are Stripe Tax enabled.

You may want to refine the subscription query to only enable taxes on a specific product or price id. This will enable taxes on all your subscriptions

for await (const subscription of stripe.subscriptions.list({limit: 100})){

  //if automatic tax is disabled, enable it
  if(!subscription.automatic_tax.enabled){
    console.log(`Enabling automatic_tax on ${subscription.id}`)
    await stripe.subscriptions.update(subscription.id, {
      automatic_tax:{
        enabled: true
      }
    })
  }
}
            

Filing Taxes

Now that you've started collecting taxes automatically there comes a time when you actually need to file all those taxes to the proper authorities.

tax reports
Stripe makes this extremely easy with their exportable tax reports. These reports can be given to your accountant, or used with one of Stripes preferred tax filing partners.

  1. 1

    Thanks for this. We've been really struggling with collecting State Tax through Stripe. I couldn't find the exportable tax reports in Stripe. Do you know where I can find this?

    1. 1

      Hey! Yeah you should be able to find it in the "Reports" section in Stripe (https://dashboard.stripe.com/tax/reporting)

  2. 1

    Do you know if this works with the Stripe integration with shopify or how to set it up?

    1. 1

      I don't believe it does currently - hopefully Shopify is working on updating their integration.

      What are you selling with Shopify? If its some sort of digital subscription there are other options than shopify if you really need this functionality

      1. 1

        It's a traditional physical product. There are solutions like TaxJar but they don't really help with registration and compliance beyond making payments. They offer a service to set it up but it costs $1000s.

Trending on Indie Hackers
Rejected from YC 18 comments Bootstrapping a SaaS that uses AI to explain code in plain English 7 comments People found our landing page confusing. 6 comments Another landing page builder ... 3 comments Live Below Your Means for Freedom 2 comments Launched our first widget 🔥 1 comment