# Taxes Learn about Stripe Tax and how to use it with invoices. On an *invoice*, Stripe Tax calculates sales tax, VAT, and GST. To calculate these for each line item, Stripe uses: - Your [tax settings](https://dashboard.stripe.com/settings/tax) - The customer’s tax settings and location - The product tax code and price tax behavior ## Set up the customer We use the customer’s location to determine the relevant taxes to collect. Customers outside of the US need at least a country-level address, while customers in the US require a 5-digit postal code. For Canada, we need at least the province or postal code. You can add customer location information in the **Customer details** page by clicking **Edit** next to **Details**. To add a customer’s location from the [Invoice Editor](https://dashboard.stripe.com/invoices/create), click the overflow menu (⋯) next to the customer. Select **Edit customer information**, click **Add additional details**, and scroll down to **Billing details**. After you update the location, click **Update customer**. Stripe applies the new location to all of your customer’s future invoices unless you update it. For more information, see [Determine customer locations](https://docs.stripe.com/tax/customer-locations.md). To create a customer with the API, send Stripe a description, and as much information as possible to help identify the location and tax requirements for your customer. We recommend populating the [customer.address](https://docs.stripe.com/api/customers/create.md#create_customer-address) field with your customer’s complete billing address. Validate the customer address upon creation by passing [tax[validate_location]=“immediately”](https://docs.stripe.com/api/customers/create.md#create_customer-tax-validate_location). You can also [expand](https://docs.stripe.com/api/expanding_objects.md) the [tax](https://docs.stripe.com/api/customers/create.md#create_customer-tax) field to confirm the location Stripe Tax identified for your customer. ```dotnet StripeConfiguration.ApiKey = "<>"; var options = new CustomerCreateOptions { Description = "a new user", Address = new AddressOptions { Line1 = "510 Townsend St", City = "San Francisco", State = "CA", Country = "US", PostalCode = "94103", }, Tax = new CustomerTaxOptions { ValidateLocation = "immediately" }, Expand = new List { "tax" }, }; var service = new CustomerService(); Customer customer = service.Create(options); ``` ```go stripe.Key = "<>" params := &stripe.CustomerParams{ Description: stripe.String("a new user"), Address: &stripe.AddressParams{ Line1: stripe.String("510 Townsend St"), City: stripe.String("San Francisco"), State: stripe.String("CA"), Country: stripe.String("US"), PostalCode: stripe.String("94103"), }, Tax: &stripe.CustomerTaxParams{ValidateLocation: stripe.String("immediately")}, }; params.AddExpand("tax") result, err := customer.New(params); ``` ```java Stripe.apiKey = "<>"; CustomerCreateParams params = CustomerCreateParams.builder() .setDescription("a new user") .setAddress( CustomerCreateParams.Address.builder() .setLine1("510 Townsend St") .setCity("San Francisco") .setState("CA") .setCountry("US") .setPostalCode("94103") .build() ) .setTax( CustomerCreateParams.Tax.builder() .setValidateLocation(CustomerCreateParams.Tax.ValidateLocation.IMMEDIATELY) .build() ) .addExpand("tax") .build(); Customer customer = Customer.create(params); ``` ```node const stripe = require('stripe')('<>'); const customer = await stripe.customers.create({ description: 'a new user', address: { line1: '510 Townsend St', city: 'San Francisco', state: 'CA', country: 'US', postal_code: '94103', }, tax: { validate_location: 'immediately', }, expand: ['tax'], }); ``` ```python import stripe stripe.api_key = "<>" customer = stripe.Customer.create( description="a new user", address={ "line1": "510 Townsend St", "city": "San Francisco", "state": "CA", "country": "US", "postal_code": "94103", }, tax={"validate_location": "immediately"}, expand=["tax"], ) ``` ```php $stripe = new \Stripe\StripeClient('<>'); $customer = $stripe->customers->create([ 'description' => 'a new user', 'address' => [ 'line1' => '510 Townsend St', 'city' => 'San Francisco', 'state' => 'CA', 'country' => 'US', 'postal_code' => '94103', ], 'tax' => ['validate_location' => 'immediately'], 'expand' => ['tax'], ]); ``` ```ruby Stripe.api_key = '<>' customer = Stripe::Customer.create({ description: 'a new user', address: { line1: '510 Townsend St', city: 'San Francisco', state: 'CA', country: 'US', postal_code: '94103', }, tax: {validate_location: 'immediately'}, expand: ['tax'], }) ``` You can also add both your customer’s country and postal code: ```dotnet StripeConfiguration.ApiKey = "<>"; var options = new CustomerCreateOptions { Description = "a new user", Address = new AddressOptions { Country = "US", PostalCode = "94103" }, Tax = new CustomerTaxOptions { ValidateLocation = "immediately" }, Expand = new List { "tax" }, }; var service = new CustomerService(); Customer customer = service.Create(options); ``` ```go stripe.Key = "<>" params := &stripe.CustomerParams{ Description: stripe.String("a new user"), Address: &stripe.AddressParams{Country: stripe.String("US"), PostalCode: stripe.String("94103")}, Tax: &stripe.CustomerTaxParams{ValidateLocation: stripe.String("immediately")}, }; params.AddExpand("tax") result, err := customer.New(params); ``` ```java Stripe.apiKey = "<>"; CustomerCreateParams params = CustomerCreateParams.builder() .setDescription("a new user") .setAddress( CustomerCreateParams.Address.builder().setCountry("US").setPostalCode("94103").build() ) .setTax( CustomerCreateParams.Tax.builder() .setValidateLocation(CustomerCreateParams.Tax.ValidateLocation.IMMEDIATELY) .build() ) .addExpand("tax") .build(); Customer customer = Customer.create(params); ``` ```node const stripe = require('stripe')('<>'); const customer = await stripe.customers.create({ description: 'a new user', address: { country: 'US', postal_code: '94103', }, tax: { validate_location: 'immediately', }, expand: ['tax'], }); ``` ```python import stripe stripe.api_key = "<>" customer = stripe.Customer.create( description="a new user", address={"country": "US", "postal_code": "94103"}, tax={"validate_location": "immediately"}, expand=["tax"], ) ``` ```php $stripe = new \Stripe\StripeClient('<>'); $customer = $stripe->customers->create([ 'description' => 'a new user', 'address' => [ 'country' => 'US', 'postal_code' => '94103', ], 'tax' => ['validate_location' => 'immediately'], 'expand' => ['tax'], ]); ``` ```ruby Stripe.api_key = '<>' customer = Stripe::Customer.create({ description: 'a new user', address: { country: 'US', postal_code: '94103', }, tax: {validate_location: 'immediately'}, expand: ['tax'], }) ``` Or only their IP address: ```dotnet StripeConfiguration.ApiKey = "<>"; var options = new CustomerCreateOptions { Description = "a new user", Tax = new CustomerTaxOptions { IpAddress = "203.0.113.0", ValidateLocation = "immediately" }, Expand = new List { "tax" }, }; var service = new CustomerService(); Customer customer = service.Create(options); ``` ```go stripe.Key = "<>" params := &stripe.CustomerParams{ Description: stripe.String("a new user"), Tax: &stripe.CustomerTaxParams{ IPAddress: stripe.String("203.0.113.0"), ValidateLocation: stripe.String("immediately"), }, }; params.AddExpand("tax") result, err := customer.New(params); ``` ```java Stripe.apiKey = "<>"; CustomerCreateParams params = CustomerCreateParams.builder() .setDescription("a new user") .setTax( CustomerCreateParams.Tax.builder() .setIpAddress("203.0.113.0") .setValidateLocation(CustomerCreateParams.Tax.ValidateLocation.IMMEDIATELY) .build() ) .addExpand("tax") .build(); Customer customer = Customer.create(params); ``` ```node const stripe = require('stripe')('<>'); const customer = await stripe.customers.create({ description: 'a new user', tax: { ip_address: '203.0.113.0', validate_location: 'immediately', }, expand: ['tax'], }); ``` ```python import stripe stripe.api_key = "<>" customer = stripe.Customer.create( description="a new user", tax={"ip_address": "203.0.113.0", "validate_location": "immediately"}, expand=["tax"], ) ``` ```php $stripe = new \Stripe\StripeClient('<>'); $customer = $stripe->customers->create([ 'description' => 'a new user', 'tax' => [ 'ip_address' => '203.0.113.0', 'validate_location' => 'immediately', ], 'expand' => ['tax'], ]); ``` ```ruby Stripe.api_key = '<>' customer = Stripe::Customer.create({ description: 'a new user', tax: { ip_address: '203.0.113.0', validate_location: 'immediately', }, expand: ['tax'], }) ``` The expanded `tax` field indicates the computed tax location and if the customer is compatible with automatic tax calculation: ```json { "id": "<>", "object": "customer", // ... other fields omitted "tax": { "location": { "country": "US", "state": "CA", "source": "billing_address" }, "ip_address": null, "automatic_tax": "supported", } } ``` The value of the [tax[automatic_tax]](https://docs.stripe.com/api/customers/object.md#customer_object-tax-automatic_tax) parameter has four possible states: | Status | Description | Possible Action | | ----------------------- | ------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `supported` | Automatic tax is fully supported. | No further action needed. | | `unrecognized_location` | The address isn’t valid for determining a tax location. | Ask the customer for an updated address and set `customer.address` to the new value. | | `not_collecting` | The address is resolvable to a location for which you haven’t set up a registration. | Depending on your tax obligations, you can either proceed and Stripe Tax won’t assess any taxes, or you might want to [add a new registration](https://docs.stripe.com/tax/registering.md) for the jurisdiction the customer is based in. | | `failed` | An error occurred with Stripe’s servers. This is rare. | Try the request again, or contact Stripe support for additional assistance. | ## Set up line items To calculate tax on each line item on an invoice, you need to set a tax behavior and optionally a tax code. ### Customize tax settings for one-off line items Customize line items in the Invoice Editor by selecting the tax behavior from the **Include tax in price** drop-down menu. ![Customize tax settings for one-off line items](images/tax/invoicing_price.png) Customize tax settings for one-off line items ### Customize tax settings for product-based line items You can use both the Dashboard and the API to customize tax settings for product-based line items. On the [Products page](https://dashboard.stripe.com/products), you can select both the tax behavior for a particular price and the optional tax code for the product. The tax behavior is per price. You can’t change the tax behavior after you select it, but you can create new prices or archive old ones. To set up a tax behavior, click **Add a price** (or **Add another price** if you already have one) and select it from the **Tax behavior** drop-down menu. To set up a tax code, select it from the **Tax code** drop-down menu when you create a new product or edit the details of an existing one. ![Customize tax settings for one-off line items](images/tax/invoicing_new_price.png) Customize tax settings for one-off line items Stripe Tax uses information stored on the [Products](https://docs.stripe.com/api/products.md) and [Prices](https://docs.stripe.com/api/prices.md) objects to determine the rates and rules to apply when calculating tax. Update the products and prices you use with Invoices to include: - [Tax behavior](https://docs.stripe.com/tax/products-prices-tax-codes-tax-behavior.md#tax-behavior)—either *inclusive* or *exclusive*. This determines whether or not tax is already included in your pricing. For example, an inclusive line item with an amount of 10 USD totals to 10 USD, whereas an exclusive line item with an amount of 10 USD totals to 10 USD plus tax. Exclusive pricing is common practice in US markets and for B2B sales, while inclusive is common practice for B2C buyers in many markets outside the US. Setting the tax behavior explicitly on a price is optional, if you [set up the default tax behavior](https://docs.stripe.com/tax/products-prices-tax-codes-tax-behavior.md#setting-tax-behavior-on-a-price-\(optional\)) in the [Stripe Tax settings](https://dashboard.stripe.com/login?redirect=%2Fsettings%2Ftax). You can override the default tax behavior setting by setting a tax behavior on a price. - [Tax code](https://docs.stripe.com/tax/products-prices-tax-codes-tax-behavior.md) (Optional)—a selection from a list of options that determine what type of product it is. Some examples include “Audio book," “Gift card," or “Software as a service." If you don’t set this explicitly, your preset tax code applies. You can’t change `tax_behavior` after it’s set to either *exclusive* or *inclusive*. If you want to change the tax behavior of a price, you need to create a new price with the desired behavior, and archive the old price. ```dotnet StripeConfiguration.ApiKey = "<>"; var options = new PriceCreateOptions { UnitAmount = 5000, Currency = "usd", TaxBehavior = "exclusive", ProductData = new PriceProductDataOptions { Name = "A new product" }, }; var service = new PriceService(); Price price = service.Create(options); ``` ```go stripe.Key = "<>" params := &stripe.PriceParams{ UnitAmount: stripe.Int64(5000), Currency: stripe.String(string(stripe.CurrencyUSD)), TaxBehavior: stripe.String(string(stripe.PriceTaxBehaviorExclusive)), ProductData: &stripe.PriceProductDataParams{Name: stripe.String("A new product")}, }; result, err := price.New(params); ``` ```java Stripe.apiKey = "<>"; PriceCreateParams params = PriceCreateParams.builder() .setUnitAmount(5000L) .setCurrency("usd") .setTaxBehavior(PriceCreateParams.TaxBehavior.EXCLUSIVE) .setProductData(PriceCreateParams.ProductData.builder().setName("A new product").build()) .build(); Price price = Price.create(params); ``` ```node const stripe = require('stripe')('<>'); const price = await stripe.prices.create({ unit_amount: 5000, currency: 'usd', tax_behavior: 'exclusive', product_data: { name: 'A new product', }, }); ``` ```python import stripe stripe.api_key = "<>" price = stripe.Price.create( unit_amount=5000, currency="usd", tax_behavior="exclusive", product_data={"name": "A new product"}, ) ``` ```php $stripe = new \Stripe\StripeClient('<>'); $price = $stripe->prices->create([ 'unit_amount' => 5000, 'currency' => 'usd', 'tax_behavior' => 'exclusive', 'product_data' => ['name' => 'A new product'], ]); ``` ```ruby Stripe.api_key = '<>' price = Stripe::Price.create({ unit_amount: 5000, currency: 'usd', tax_behavior: 'exclusive', product_data: {name: 'A new product'}, }) ``` ## Enable automatic tax Enable the **Use automatic tax collection** toggle on the [tax settings](https://dashboard.stripe.com/settings/tax/integrations) page to automatically enable tax calculation on _new_ invoices you create in the Dashboard. ![Stripe Dashboard with the automatic tax toggle set to true](images/tax/dashboard_automatic_tax.png) Stripe Dashboard with the automatic tax toggle set to true ### Update untaxed invoices To enable automatic tax calculation for existing invoices: 1. Click **Edit invoice** from the **Invoice details** page, or click the invoice’s overflow menu (⋯), then **Edit invoice** from the [Invoices page](https://dashboard.stripe.com/test/invoices) to create a new draft in the **Invoice Editor**. 1. In the editor, turn on the **Collect tax automatically** toggle. 1. If customer is missing address information required for tax calculation, a notification badge alerts you and provides instructions to resolve the problem. ![Invoice editor with the warning badge about missing customer address](images/tax/invoice_no_address_badge.png) Invoice editor with the warning badge about missing customer address 1. Save the invoice to enable automatic tax calculations on all future instances of the invoice. Learn more about [editing invoices after finalization](https://docs.stripe.com/invoicing/invoice-edits.md). ### Update invoices with existing tax rates To replace invoice [tax rates](https://docs.stripe.com/billing/taxes/tax-rates.md) with automatic tax calculation, follow the previous steps to edit the invoice. Then remove the applied tax rates and enable the **Collect tax automatically** toggle. After specifying a tax behavior and tax code, you can add the price to the customer as an invoice item: ```dotnet StripeConfiguration.ApiKey = "<>"; var options = new InvoiceItemCreateOptions { Customer = "<>", Pricing = new InvoiceItemPricingOptions { Price = "<>" }, }; var service = new InvoiceItemService(); InvoiceItem invoiceItem = service.Create(options); ``` ```go stripe.Key = "<>" params := &stripe.InvoiceItemParams{ Customer: stripe.String("<>"), Pricing: &stripe.InvoiceItemPricingParams{Price: stripe.String("<>")}, }; result, err := invoiceitem.New(params); ``` ```java Stripe.apiKey = "<>"; InvoiceItemCreateParams params = InvoiceItemCreateParams.builder() .setCustomer("<>") .setPricing(InvoiceItemCreateParams.Pricing.builder().setPrice("<>").build()) .build(); InvoiceItem invoiceItem = InvoiceItem.create(params); ``` ```node const stripe = require('stripe')('<>'); const invoiceItem = await stripe.invoiceItems.create({ customer: '<>', pricing: { price: '<>', }, }); ``` ```python import stripe stripe.api_key = "<>" invoice_item = stripe.InvoiceItem.create( customer="<>", pricing={"price": "<>"}, ) ``` ```php $stripe = new \Stripe\StripeClient('<>'); $invoiceItem = $stripe->invoiceItems->create([ 'customer' => '<>', 'pricing' => ['price' => '<>'], ]); ``` ```ruby Stripe.api_key = '<>' invoice_item = Stripe::InvoiceItem.create({ customer: '<>', pricing: {price: '<>'}, }) ``` Set the toggle in the **Invoice Editor**. In the API, you need to pass the `automatic_tax` field to enable or disable automatic tax calculation. Both steps are required to start calculating tax automatically. ```dotnet StripeConfiguration.ApiKey = "<>"; var options = new InvoiceCreateOptions { Customer = "<>", AutomaticTax = new InvoiceAutomaticTaxOptions { Enabled = true }, }; var service = new InvoiceService(); Invoice invoice = service.Create(options); ``` ```go stripe.Key = "<>" params := &stripe.InvoiceParams{ Customer: stripe.String("<>"), AutomaticTax: &stripe.InvoiceAutomaticTaxParams{Enabled: stripe.Bool(true)}, }; result, err := invoice.New(params); ``` ```java Stripe.apiKey = "<>"; InvoiceCreateParams params = InvoiceCreateParams.builder() .setCustomer("<>") .setAutomaticTax(InvoiceCreateParams.AutomaticTax.builder().setEnabled(true).build()) .build(); Invoice invoice = Invoice.create(params); ``` ```node const stripe = require('stripe')('<>'); const invoice = await stripe.invoices.create({ customer: '<>', automatic_tax: { enabled: true, }, }); ``` ```python import stripe stripe.api_key = "<>" invoice = stripe.Invoice.create( customer="<>", automatic_tax={"enabled": True}, ) ``` ```php $stripe = new \Stripe\StripeClient('<>'); $invoice = $stripe->invoices->create([ 'customer' => '<>', 'automatic_tax' => ['enabled' => true], ]); ``` ```ruby Stripe.api_key = '<>' invoice = Stripe::Invoice.create({ customer: '<>', automatic_tax: {enabled: true}, }) ``` To enable automatic tax calculation when you update an invoice, add the `invoice` parameter alongside `automatic_tax`: ```dotnet StripeConfiguration.ApiKey = "<>"; var options = new InvoiceUpdateOptions { AutomaticTax = new InvoiceAutomaticTaxOptions { Enabled = true }, }; var service = new InvoiceService(); Invoice invoice = service.Update("<>", options); ``` ```go stripe.Key = "<>" params := &stripe.InvoiceParams{ AutomaticTax: &stripe.InvoiceAutomaticTaxParams{Enabled: stripe.Bool(true)}, }; result, err := invoice.Update("<>", params); ``` ```java Stripe.apiKey = "<>"; Invoice resource = Invoice.retrieve("<>"); InvoiceUpdateParams params = InvoiceUpdateParams.builder() .setAutomaticTax(InvoiceUpdateParams.AutomaticTax.builder().setEnabled(true).build()) .build(); Invoice invoice = resource.update(params); ``` ```node const stripe = require('stripe')('<>'); const invoice = await stripe.invoices.update( '<>', { automatic_tax: { enabled: true, }, } ); ``` ```python import stripe stripe.api_key = "<>" invoice = stripe.Invoice.modify( "<>", automatic_tax={"enabled": True}, ) ``` ```php $stripe = new \Stripe\StripeClient('<>'); $invoice = $stripe->invoices->update('<>', ['automatic_tax' => ['enabled' => true]]); ``` ```ruby Stripe.api_key = '<>' invoice = Stripe::Invoice.update('<>', {automatic_tax: {enabled: true}}) ``` For more information on automatic tax calculation, see [Automatically collect tax on invoices](https://docs.stripe.com/tax/invoicing.md). ## Net prices and taxes You can issue invoices with line item prices that exclude inclusive tax. Tax-exclusive prices are only shown in the invoice PDF. That means, when using inclusive tax, the Hosted Invoice Page and invoice emails show tax-inclusive prices. You can define the settings for net prices in the Dashboard or API. - **Include inclusive tax**—The invoice PDF displays line item prices including the inclusive tax. (This is the default.) - **Exclude tax**—The invoice PDF displays line item prices excluding tax. If you set a default for line item prices at the customer level, it takes precedence over account-level settings. To set a default for item prices, go to **Default item prices** in the [Invoice template](https://dashboard.stripe.com/settings/billing/invoice). Your chosen setting applies to all of the invoices you create through the Dashboard or API. For one-off invoices, use the [Invoice Editor](https://dashboard.stripe.com/test/invoices/create) to set tax exclusivity. Go to **Advanced options** and choose to **Include inclusive tax** or **Exclude tax**. To learn more, see [Create an invoice](https://docs.stripe.com/invoicing/dashboard.md#create-invoice). You can use the API to set a default for item prices for each customer. Your chosen setting applies to all of the invoices you create through the Dashboard or API. To turn this setting on, use the `rendering_options[amount_tax_display]` field in the `invoice_settings` hash when you [create](https://docs.stripe.com/api/customers/create.md#create_customer-invoice_settings) or [update](https://docs.stripe.com/api/customers/update.md#update_customer-invoice_settings) a customer. The `rendering_options[amount_tax_display]` field accepts the following values: `exclude_tax` and `include_inclusive_tax`. ```json { "invoice_settings": { "rendering_options": { "amount_tax_display": "exclude_tax" }, "custom_fields": null, "default_payment_method": null, "footer": null } } ``` ## See Also - [Determine customer locations](https://docs.stripe.com/tax/customer-locations.md) - [Understand zero tax amounts](https://docs.stripe.com/tax/zero-tax.md) - [Reporting and filing](https://docs.stripe.com/tax/reports.md)