--- title: Taxes subtitle: Learn about Stripe Tax and how to use it with invoices. route: /invoicing/taxes --- # Taxes Learn about Stripe Tax and how to use it with invoices. On an *invoice* (Invoices are statements of amounts owed by a customer. They track the status of payments from draft through paid or otherwise finalized. Subscriptions automatically generate invoices, or you can manually create a one-off 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. #### Dashboard 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://stripe.com/tax/customer-locations). #### API 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://stripe.com/api/customers/create#create_customer-address) field with your customer’s complete billing address. Validate the customer address upon creation by passing [tax[validate_location]=“immediately”](https://stripe.com/api/customers/create#create_customer-tax-validate_location). You can also [expand](https://stripe.com/api/expanding_objects) the [tax](https://stripe.com/api/customers/create#create_customer-tax) field to confirm the location Stripe Tax identified for your customer. Code snippet calling post /v1/customers in curl (resource-based pattern). ```curl curl https://api.stripe.com/v1/customers \ -u "sk_test_BQokikJOvBiI2HlWgH4olfQ2:" \ -d description="a new user" \ -d "address[line1]"="510 Townsend St" \ -d "address[city]"="San Francisco" \ -d "address[state]"=CA \ -d "address[country]"=US \ -d "address[postal_code]"=94103 \ -d "tax[validate_location]"=immediately \ -d "expand[]"=tax ``` Code snippet calling post /v1/customers in cli (resource-based pattern). ```cli stripe customers create \ --description="a new user" \ -d "address[line1]"="510 Townsend St" \ -d "address[city]"="San Francisco" \ -d "address[state]"=CA \ -d "address[country]"=US \ -d "address[postal_code]"=94103 \ -d "tax[validate_location]"=immediately \ -d "expand[0]"=tax ``` Code snippet calling post /v1/customers in ruby (resource-based pattern). ```ruby # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys Stripe.api_key = 'sk_test_BQokikJOvBiI2HlWgH4olfQ2' 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'], }) ``` Code snippet calling post /v1/customers in ruby (service-based pattern). ```ruby # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys client = Stripe::StripeClient.new("sk_test_BQokikJOvBiI2HlWgH4olfQ2") customer = client.v1.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'], }) ``` Code snippet calling post /v1/customers in python (resource-based pattern). ```python # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys import stripe stripe.api_key = "sk_test_BQokikJOvBiI2HlWgH4olfQ2" 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"], ) ``` Code snippet calling post /v1/customers in python (service-based pattern). ```python # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys client = StripeClient("sk_test_BQokikJOvBiI2HlWgH4olfQ2") customer = client.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"], }) ``` Code snippet calling post /v1/customers in php (resource-based pattern). ```php // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys $stripe = new \Stripe\StripeClient('sk_test_BQokikJOvBiI2HlWgH4olfQ2'); $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'], ]); ``` Code snippet calling post /v1/customers in java (resource-based pattern). ```java // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys Stripe.apiKey = "sk_test_BQokikJOvBiI2HlWgH4olfQ2"; 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); ``` Code snippet calling post /v1/customers in java (service-based pattern). ```java // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys StripeClient client = new StripeClient("sk_test_BQokikJOvBiI2HlWgH4olfQ2"); 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 = client.customers().create(params); ``` Code snippet calling post /v1/customers in node (resource-based pattern). ```node // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys const stripe = require('stripe')('sk_test_BQokikJOvBiI2HlWgH4olfQ2'); 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'], }); ``` Code snippet calling post /v1/customers in go (resource-based pattern). ```go // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys stripe.Key = "sk_test_BQokikJOvBiI2HlWgH4olfQ2" 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); ``` Code snippet calling post /v1/customers in go (service-based pattern). ```go // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys sc := stripe.NewClient("sk_test_BQokikJOvBiI2HlWgH4olfQ2"); params := &stripe.CustomerCreateParams{ 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.CustomerCreateTaxParams{ValidateLocation: stripe.String("immediately")}, }; params.AddExpand("tax") result, err := sc.V1Customers.Create(context.TODO(), params); ``` Code snippet calling post /v1/customers in dotnet (resource-based pattern). ```dotnet // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys StripeConfiguration.ApiKey = "sk_test_BQokikJOvBiI2HlWgH4olfQ2"; 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); ``` Code snippet calling post /v1/customers in dotnet (service-based pattern). ```dotnet // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys 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 client = new StripeClient("sk_test_BQokikJOvBiI2HlWgH4olfQ2"); var service = client.V1.Customers; Customer customer = service.Create(options); ``` You can also add both your customer’s country and postal code: Code snippet calling post /v1/customers in curl (resource-based pattern). ```curl curl https://api.stripe.com/v1/customers \ -u "sk_test_BQokikJOvBiI2HlWgH4olfQ2:" \ -d description="a new user" \ -d "address[country]"=US \ -d "address[postal_code]"=94103 \ -d "tax[validate_location]"=immediately \ -d "expand[]"=tax ``` Code snippet calling post /v1/customers in cli (resource-based pattern). ```cli stripe customers create \ --description="a new user" \ -d "address[country]"=US \ -d "address[postal_code]"=94103 \ -d "tax[validate_location]"=immediately \ -d "expand[0]"=tax ``` Code snippet calling post /v1/customers in ruby (resource-based pattern). ```ruby # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys Stripe.api_key = 'sk_test_BQokikJOvBiI2HlWgH4olfQ2' customer = Stripe::Customer.create({ description: 'a new user', address: { country: 'US', postal_code: '94103', }, tax: {validate_location: 'immediately'}, expand: ['tax'], }) ``` Code snippet calling post /v1/customers in ruby (service-based pattern). ```ruby # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys client = Stripe::StripeClient.new("sk_test_BQokikJOvBiI2HlWgH4olfQ2") customer = client.v1.customers.create({ description: 'a new user', address: { country: 'US', postal_code: '94103', }, tax: {validate_location: 'immediately'}, expand: ['tax'], }) ``` Code snippet calling post /v1/customers in python (resource-based pattern). ```python # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys import stripe stripe.api_key = "sk_test_BQokikJOvBiI2HlWgH4olfQ2" customer = stripe.Customer.create( description="a new user", address={"country": "US", "postal_code": "94103"}, tax={"validate_location": "immediately"}, expand=["tax"], ) ``` Code snippet calling post /v1/customers in python (service-based pattern). ```python # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys client = StripeClient("sk_test_BQokikJOvBiI2HlWgH4olfQ2") customer = client.customers.create({ "description": "a new user", "address": {"country": "US", "postal_code": "94103"}, "tax": {"validate_location": "immediately"}, "expand": ["tax"], }) ``` Code snippet calling post /v1/customers in php (resource-based pattern). ```php // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys $stripe = new \Stripe\StripeClient('sk_test_BQokikJOvBiI2HlWgH4olfQ2'); $customer = $stripe->customers->create([ 'description' => 'a new user', 'address' => [ 'country' => 'US', 'postal_code' => '94103', ], 'tax' => ['validate_location' => 'immediately'], 'expand' => ['tax'], ]); ``` Code snippet calling post /v1/customers in java (resource-based pattern). ```java // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys Stripe.apiKey = "sk_test_BQokikJOvBiI2HlWgH4olfQ2"; 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); ``` Code snippet calling post /v1/customers in java (service-based pattern). ```java // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys StripeClient client = new StripeClient("sk_test_BQokikJOvBiI2HlWgH4olfQ2"); 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 = client.customers().create(params); ``` Code snippet calling post /v1/customers in node (resource-based pattern). ```node // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys const stripe = require('stripe')('sk_test_BQokikJOvBiI2HlWgH4olfQ2'); const customer = await stripe.customers.create({ description: 'a new user', address: { country: 'US', postal_code: '94103', }, tax: { validate_location: 'immediately', }, expand: ['tax'], }); ``` Code snippet calling post /v1/customers in go (resource-based pattern). ```go // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys stripe.Key = "sk_test_BQokikJOvBiI2HlWgH4olfQ2" 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); ``` Code snippet calling post /v1/customers in go (service-based pattern). ```go // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys sc := stripe.NewClient("sk_test_BQokikJOvBiI2HlWgH4olfQ2"); params := &stripe.CustomerCreateParams{ Description: stripe.String("a new user"), Address: &stripe.AddressParams{ Country: stripe.String("US"), PostalCode: stripe.String("94103"), }, Tax: &stripe.CustomerCreateTaxParams{ValidateLocation: stripe.String("immediately")}, }; params.AddExpand("tax") result, err := sc.V1Customers.Create(context.TODO(), params); ``` Code snippet calling post /v1/customers in dotnet (resource-based pattern). ```dotnet // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys StripeConfiguration.ApiKey = "sk_test_BQokikJOvBiI2HlWgH4olfQ2"; 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); ``` Code snippet calling post /v1/customers in dotnet (service-based pattern). ```dotnet // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys 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 client = new StripeClient("sk_test_BQokikJOvBiI2HlWgH4olfQ2"); var service = client.V1.Customers; Customer customer = service.Create(options); ``` Or only their IP address: Code snippet calling post /v1/customers in curl (resource-based pattern). ```curl curl https://api.stripe.com/v1/customers \ -u "sk_test_BQokikJOvBiI2HlWgH4olfQ2:" \ -d description="a new user" \ -d "tax[ip_address]"="203.0.113.0" \ -d "tax[validate_location]"=immediately \ -d "expand[]"=tax ``` Code snippet calling post /v1/customers in cli (resource-based pattern). ```cli stripe customers create \ --description="a new user" \ -d "tax[ip_address]"="203.0.113.0" \ -d "tax[validate_location]"=immediately \ -d "expand[0]"=tax ``` Code snippet calling post /v1/customers in ruby (resource-based pattern). ```ruby # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys Stripe.api_key = 'sk_test_BQokikJOvBiI2HlWgH4olfQ2' customer = Stripe::Customer.create({ description: 'a new user', tax: { ip_address: '203.0.113.0', validate_location: 'immediately', }, expand: ['tax'], }) ``` Code snippet calling post /v1/customers in ruby (service-based pattern). ```ruby # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys client = Stripe::StripeClient.new("sk_test_BQokikJOvBiI2HlWgH4olfQ2") customer = client.v1.customers.create({ description: 'a new user', tax: { ip_address: '203.0.113.0', validate_location: 'immediately', }, expand: ['tax'], }) ``` Code snippet calling post /v1/customers in python (resource-based pattern). ```python # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys import stripe stripe.api_key = "sk_test_BQokikJOvBiI2HlWgH4olfQ2" customer = stripe.Customer.create( description="a new user", tax={"ip_address": "203.0.113.0", "validate_location": "immediately"}, expand=["tax"], ) ``` Code snippet calling post /v1/customers in python (service-based pattern). ```python # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys client = StripeClient("sk_test_BQokikJOvBiI2HlWgH4olfQ2") customer = client.customers.create({ "description": "a new user", "tax": {"ip_address": "203.0.113.0", "validate_location": "immediately"}, "expand": ["tax"], }) ``` Code snippet calling post /v1/customers in php (resource-based pattern). ```php // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys $stripe = new \Stripe\StripeClient('sk_test_BQokikJOvBiI2HlWgH4olfQ2'); $customer = $stripe->customers->create([ 'description' => 'a new user', 'tax' => [ 'ip_address' => '203.0.113.0', 'validate_location' => 'immediately', ], 'expand' => ['tax'], ]); ``` Code snippet calling post /v1/customers in java (resource-based pattern). ```java // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys Stripe.apiKey = "sk_test_BQokikJOvBiI2HlWgH4olfQ2"; 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); ``` Code snippet calling post /v1/customers in java (service-based pattern). ```java // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys StripeClient client = new StripeClient("sk_test_BQokikJOvBiI2HlWgH4olfQ2"); 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 = client.customers().create(params); ``` Code snippet calling post /v1/customers in node (resource-based pattern). ```node // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys const stripe = require('stripe')('sk_test_BQokikJOvBiI2HlWgH4olfQ2'); const customer = await stripe.customers.create({ description: 'a new user', tax: { ip_address: '203.0.113.0', validate_location: 'immediately', }, expand: ['tax'], }); ``` Code snippet calling post /v1/customers in go (resource-based pattern). ```go // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys stripe.Key = "sk_test_BQokikJOvBiI2HlWgH4olfQ2" 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); ``` Code snippet calling post /v1/customers in go (service-based pattern). ```go // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys sc := stripe.NewClient("sk_test_BQokikJOvBiI2HlWgH4olfQ2"); params := &stripe.CustomerCreateParams{ Description: stripe.String("a new user"), Tax: &stripe.CustomerCreateTaxParams{ IPAddress: stripe.String("203.0.113.0"), ValidateLocation: stripe.String("immediately"), }, }; params.AddExpand("tax") result, err := sc.V1Customers.Create(context.TODO(), params); ``` Code snippet calling post /v1/customers in dotnet (resource-based pattern). ```dotnet // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys StripeConfiguration.ApiKey = "sk_test_BQokikJOvBiI2HlWgH4olfQ2"; 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); ``` Code snippet calling post /v1/customers in dotnet (service-based pattern). ```dotnet // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys var options = new CustomerCreateOptions { Description = "a new user", Tax = new CustomerTaxOptions { IpAddress = "203.0.113.0", ValidateLocation = "immediately", }, Expand = new List { "tax" }, }; var client = new StripeClient("sk_test_BQokikJOvBiI2HlWgH4olfQ2"); var service = client.V1.Customers; Customer customer = service.Create(options); ``` The expanded `tax` field indicates the computed tax location and if the customer is compatible with automatic tax calculation: ```json { "id": ""{{CUSTOMER_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://stripe.com/api/customers/object#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://stripe.com/tax/registering) 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](https://b.stripecdn.com/docs-statics-srv/assets/invoicing_price.faa90fb6b3cb833b900e06cb2187d339.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. #### Dashboard 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](https://b.stripecdn.com/docs-statics-srv/assets/invoicing_new_price.517f186f27925e52e501019b9aecc94b.png) Customize tax settings for one-off line items #### API Stripe Tax uses information stored on the [Products](https://stripe.com/api/products) and [Prices](https://stripe.com/api/prices) 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://stripe.com/tax/products-prices-tax-codes-tax-behavior#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://stripe.com/tax/products-prices-tax-codes-tax-behavior#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://stripe.com/tax/products-prices-tax-codes-tax-behavior) (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. Code snippet calling post /v1/prices in curl (resource-based pattern). ```curl curl https://api.stripe.com/v1/prices \ -u "sk_test_BQokikJOvBiI2HlWgH4olfQ2:" \ -d unit_amount=5000 \ -d currency=usd \ -d tax_behavior=exclusive \ -d "product_data[name]"="A new product" ``` Code snippet calling post /v1/prices in cli (resource-based pattern). ```cli stripe prices create \ --unit-amount=5000 \ --currency=usd \ --tax-behavior=exclusive \ -d "product_data[name]"="A new product" ``` Code snippet calling post /v1/prices in ruby (resource-based pattern). ```ruby # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys Stripe.api_key = 'sk_test_BQokikJOvBiI2HlWgH4olfQ2' price = Stripe::Price.create({ unit_amount: 5000, currency: 'usd', tax_behavior: 'exclusive', product_data: {name: 'A new product'}, }) ``` Code snippet calling post /v1/prices in ruby (service-based pattern). ```ruby # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys client = Stripe::StripeClient.new("sk_test_BQokikJOvBiI2HlWgH4olfQ2") price = client.v1.prices.create({ unit_amount: 5000, currency: 'usd', tax_behavior: 'exclusive', product_data: {name: 'A new product'}, }) ``` Code snippet calling post /v1/prices in python (resource-based pattern). ```python # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys import stripe stripe.api_key = "sk_test_BQokikJOvBiI2HlWgH4olfQ2" price = stripe.Price.create( unit_amount=5000, currency="usd", tax_behavior="exclusive", product_data={"name": "A new product"}, ) ``` Code snippet calling post /v1/prices in python (service-based pattern). ```python # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys client = StripeClient("sk_test_BQokikJOvBiI2HlWgH4olfQ2") price = client.prices.create({ "unit_amount": 5000, "currency": "usd", "tax_behavior": "exclusive", "product_data": {"name": "A new product"}, }) ``` Code snippet calling post /v1/prices in php (resource-based pattern). ```php // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys $stripe = new \Stripe\StripeClient('sk_test_BQokikJOvBiI2HlWgH4olfQ2'); $price = $stripe->prices->create([ 'unit_amount' => 5000, 'currency' => 'usd', 'tax_behavior' => 'exclusive', 'product_data' => ['name' => 'A new product'], ]); ``` Code snippet calling post /v1/prices in java (resource-based pattern). ```java // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys Stripe.apiKey = "sk_test_BQokikJOvBiI2HlWgH4olfQ2"; 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); ``` Code snippet calling post /v1/prices in java (service-based pattern). ```java // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys StripeClient client = new StripeClient("sk_test_BQokikJOvBiI2HlWgH4olfQ2"); PriceCreateParams params = PriceCreateParams.builder() .setUnitAmount(5000L) .setCurrency("usd") .setTaxBehavior(PriceCreateParams.TaxBehavior.EXCLUSIVE) .setProductData( PriceCreateParams.ProductData.builder().setName("A new product").build() ) .build(); Price price = client.prices().create(params); ``` Code snippet calling post /v1/prices in node (resource-based pattern). ```node // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys const stripe = require('stripe')('sk_test_BQokikJOvBiI2HlWgH4olfQ2'); const price = await stripe.prices.create({ unit_amount: 5000, currency: 'usd', tax_behavior: 'exclusive', product_data: { name: 'A new product', }, }); ``` Code snippet calling post /v1/prices in go (resource-based pattern). ```go // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys stripe.Key = "sk_test_BQokikJOvBiI2HlWgH4olfQ2" params := &stripe.PriceParams{ UnitAmount: stripe.Int64(5000), Currency: stripe.String(stripe.CurrencyUSD), TaxBehavior: stripe.String(stripe.PriceTaxBehaviorExclusive), ProductData: &stripe.PriceProductDataParams{Name: stripe.String("A new product")}, }; result, err := price.New(params); ``` Code snippet calling post /v1/prices in go (service-based pattern). ```go // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys sc := stripe.NewClient("sk_test_BQokikJOvBiI2HlWgH4olfQ2"); params := &stripe.PriceCreateParams{ UnitAmount: stripe.Int64(5000), Currency: stripe.String(stripe.CurrencyUSD), TaxBehavior: stripe.String(stripe.PriceTaxBehaviorExclusive), ProductData: &stripe.PriceCreateProductDataParams{Name: stripe.String("A new product")}, }; result, err := sc.V1Prices.Create(context.TODO(), params); ``` Code snippet calling post /v1/prices in dotnet (resource-based pattern). ```dotnet // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys StripeConfiguration.ApiKey = "sk_test_BQokikJOvBiI2HlWgH4olfQ2"; 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); ``` Code snippet calling post /v1/prices in dotnet (service-based pattern). ```dotnet // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys var options = new PriceCreateOptions { UnitAmount = 5000, Currency = "usd", TaxBehavior = "exclusive", ProductData = new PriceProductDataOptions { Name = "A new product" }, }; var client = new StripeClient("sk_test_BQokikJOvBiI2HlWgH4olfQ2"); var service = client.V1.Prices; Price price = service.Create(options); ``` ## Enable automatic tax #### Dashboard [Log in](https://dashboard.stripe.com/settings/tax) or [sign up](https://dashboard.stripe.com/register) for Stripe to enable Stripe 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](https://b.stripecdn.com/docs-statics-srv/assets/dashboard_automatic_tax.2338adf39e3a07ad9acd79c036e7c637.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](https://b.stripecdn.com/docs-statics-srv/assets/invoice_no_address_badge.cf9ee01e250675ea8742a948ddbd59d6.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://stripe.com/invoicing/invoice-edits). ### Update invoices with existing tax rates To replace invoice [tax rates](https://stripe.com/billing/taxes/tax-rates) 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. #### API After specifying a tax behavior and tax code, you can add the price to the customer as an invoice item: Code snippet calling post /v1/invoiceitems in curl (resource-based pattern). ```curl curl https://api.stripe.com/v1/invoiceitems \ -u "sk_test_BQokikJOvBiI2HlWgH4olfQ2:" \ -d customer="{{CUSTOMER_ID}}" \ -d "pricing[price]"="{{PRICE_ID}}" ``` Code snippet calling post /v1/invoiceitems in cli (resource-based pattern). ```cli stripe invoiceitems create \ --customer="{{CUSTOMER_ID}}" \ -d "pricing[price]"="{{PRICE_ID}}" ``` Code snippet calling post /v1/invoiceitems in ruby (resource-based pattern). ```ruby # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys Stripe.api_key = 'sk_test_BQokikJOvBiI2HlWgH4olfQ2' invoice_item = Stripe::InvoiceItem.create({ customer: '{{CUSTOMER_ID}}', pricing: {price: '{{PRICE_ID}}'}, }) ``` Code snippet calling post /v1/invoiceitems in ruby (service-based pattern). ```ruby # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys client = Stripe::StripeClient.new("sk_test_BQokikJOvBiI2HlWgH4olfQ2") invoice_item = client.v1.invoice_items.create({ customer: '{{CUSTOMER_ID}}', pricing: {price: '{{PRICE_ID}}'}, }) ``` Code snippet calling post /v1/invoiceitems in python (resource-based pattern). ```python # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys import stripe stripe.api_key = "sk_test_BQokikJOvBiI2HlWgH4olfQ2" invoice_item = stripe.InvoiceItem.create( customer="{{CUSTOMER_ID}}", pricing={"price": "{{PRICE_ID}}"}, ) ``` Code snippet calling post /v1/invoiceitems in python (service-based pattern). ```python # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys client = StripeClient("sk_test_BQokikJOvBiI2HlWgH4olfQ2") invoice_item = client.invoice_items.create({ "customer": "{{CUSTOMER_ID}}", "pricing": {"price": "{{PRICE_ID}}"}, }) ``` Code snippet calling post /v1/invoiceitems in php (resource-based pattern). ```php // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys $stripe = new \Stripe\StripeClient('sk_test_BQokikJOvBiI2HlWgH4olfQ2'); $invoiceItem = $stripe->invoiceItems->create([ 'customer' => '{{CUSTOMER_ID}}', 'pricing' => ['price' => '{{PRICE_ID}}'], ]); ``` Code snippet calling post /v1/invoiceitems in java (resource-based pattern). ```java // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys Stripe.apiKey = "sk_test_BQokikJOvBiI2HlWgH4olfQ2"; InvoiceItemCreateParams params = InvoiceItemCreateParams.builder() .setCustomer("{{CUSTOMER_ID}}") .setPricing( InvoiceItemCreateParams.Pricing.builder().setPrice("{{PRICE_ID}}").build() ) .build(); InvoiceItem invoiceItem = InvoiceItem.create(params); ``` Code snippet calling post /v1/invoiceitems in java (service-based pattern). ```java // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys StripeClient client = new StripeClient("sk_test_BQokikJOvBiI2HlWgH4olfQ2"); InvoiceItemCreateParams params = InvoiceItemCreateParams.builder() .setCustomer("{{CUSTOMER_ID}}") .setPricing( InvoiceItemCreateParams.Pricing.builder().setPrice("{{PRICE_ID}}").build() ) .build(); InvoiceItem invoiceItem = client.invoiceItems().create(params); ``` Code snippet calling post /v1/invoiceitems in node (resource-based pattern). ```node // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys const stripe = require('stripe')('sk_test_BQokikJOvBiI2HlWgH4olfQ2'); const invoiceItem = await stripe.invoiceItems.create({ customer: '{{CUSTOMER_ID}}', pricing: { price: '{{PRICE_ID}}', }, }); ``` Code snippet calling post /v1/invoiceitems in go (resource-based pattern). ```go // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys stripe.Key = "sk_test_BQokikJOvBiI2HlWgH4olfQ2" params := &stripe.InvoiceItemParams{ Customer: stripe.String("{{CUSTOMER_ID}}"), Pricing: &stripe.InvoiceItemPricingParams{Price: stripe.String("{{PRICE_ID}}")}, }; result, err := invoiceitem.New(params); ``` Code snippet calling post /v1/invoiceitems in go (service-based pattern). ```go // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys sc := stripe.NewClient("sk_test_BQokikJOvBiI2HlWgH4olfQ2"); params := &stripe.InvoiceItemCreateParams{ Customer: stripe.String("{{CUSTOMER_ID}}"), Pricing: &stripe.InvoiceItemCreatePricingParams{ Price: stripe.String("{{PRICE_ID}}"), }, }; result, err := sc.V1InvoiceItems.Create(context.TODO(), params); ``` Code snippet calling post /v1/invoiceitems in dotnet (resource-based pattern). ```dotnet // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys StripeConfiguration.ApiKey = "sk_test_BQokikJOvBiI2HlWgH4olfQ2"; var options = new InvoiceItemCreateOptions { Customer = "{{CUSTOMER_ID}}", Pricing = new InvoiceItemPricingOptions { Price = "{{PRICE_ID}}" }, }; var service = new InvoiceItemService(); InvoiceItem invoiceItem = service.Create(options); ``` Code snippet calling post /v1/invoiceitems in dotnet (service-based pattern). ```dotnet // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys var options = new InvoiceItemCreateOptions { Customer = "{{CUSTOMER_ID}}", Pricing = new InvoiceItemPricingOptions { Price = "{{PRICE_ID}}" }, }; var client = new StripeClient("sk_test_BQokikJOvBiI2HlWgH4olfQ2"); var service = client.V1.InvoiceItems; InvoiceItem invoiceItem = service.Create(options); ``` 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. Code snippet calling post /v1/invoices in curl (resource-based pattern). ```curl curl https://api.stripe.com/v1/invoices \ -u "sk_test_BQokikJOvBiI2HlWgH4olfQ2:" \ -d customer="{{CUSTOMER_ID}}" \ -d "automatic_tax[enabled]"=true ``` Code snippet calling post /v1/invoices in cli (resource-based pattern). ```cli stripe invoices create \ --customer="{{CUSTOMER_ID}}" \ -d "automatic_tax[enabled]"=true ``` Code snippet calling post /v1/invoices in ruby (resource-based pattern). ```ruby # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys Stripe.api_key = 'sk_test_BQokikJOvBiI2HlWgH4olfQ2' invoice = Stripe::Invoice.create({ customer: '{{CUSTOMER_ID}}', automatic_tax: {enabled: true}, }) ``` Code snippet calling post /v1/invoices in ruby (service-based pattern). ```ruby # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys client = Stripe::StripeClient.new("sk_test_BQokikJOvBiI2HlWgH4olfQ2") invoice = client.v1.invoices.create({ customer: '{{CUSTOMER_ID}}', automatic_tax: {enabled: true}, }) ``` Code snippet calling post /v1/invoices in python (resource-based pattern). ```python # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys import stripe stripe.api_key = "sk_test_BQokikJOvBiI2HlWgH4olfQ2" invoice = stripe.Invoice.create( customer="{{CUSTOMER_ID}}", automatic_tax={"enabled": True}, ) ``` Code snippet calling post /v1/invoices in python (service-based pattern). ```python # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys client = StripeClient("sk_test_BQokikJOvBiI2HlWgH4olfQ2") invoice = client.invoices.create({ "customer": "{{CUSTOMER_ID}}", "automatic_tax": {"enabled": True}, }) ``` Code snippet calling post /v1/invoices in php (resource-based pattern). ```php // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys $stripe = new \Stripe\StripeClient('sk_test_BQokikJOvBiI2HlWgH4olfQ2'); $invoice = $stripe->invoices->create([ 'customer' => '{{CUSTOMER_ID}}', 'automatic_tax' => ['enabled' => true], ]); ``` Code snippet calling post /v1/invoices in java (resource-based pattern). ```java // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys Stripe.apiKey = "sk_test_BQokikJOvBiI2HlWgH4olfQ2"; InvoiceCreateParams params = InvoiceCreateParams.builder() .setCustomer("{{CUSTOMER_ID}}") .setAutomaticTax(InvoiceCreateParams.AutomaticTax.builder().setEnabled(true).build()) .build(); Invoice invoice = Invoice.create(params); ``` Code snippet calling post /v1/invoices in java (service-based pattern). ```java // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys StripeClient client = new StripeClient("sk_test_BQokikJOvBiI2HlWgH4olfQ2"); InvoiceCreateParams params = InvoiceCreateParams.builder() .setCustomer("{{CUSTOMER_ID}}") .setAutomaticTax(InvoiceCreateParams.AutomaticTax.builder().setEnabled(true).build()) .build(); Invoice invoice = client.invoices().create(params); ``` Code snippet calling post /v1/invoices in node (resource-based pattern). ```node // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys const stripe = require('stripe')('sk_test_BQokikJOvBiI2HlWgH4olfQ2'); const invoice = await stripe.invoices.create({ customer: '{{CUSTOMER_ID}}', automatic_tax: { enabled: true, }, }); ``` Code snippet calling post /v1/invoices in go (resource-based pattern). ```go // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys stripe.Key = "sk_test_BQokikJOvBiI2HlWgH4olfQ2" params := &stripe.InvoiceParams{ Customer: stripe.String("{{CUSTOMER_ID}}"), AutomaticTax: &stripe.InvoiceAutomaticTaxParams{Enabled: stripe.Bool(true)}, }; result, err := invoice.New(params); ``` Code snippet calling post /v1/invoices in go (service-based pattern). ```go // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys sc := stripe.NewClient("sk_test_BQokikJOvBiI2HlWgH4olfQ2"); params := &stripe.InvoiceCreateParams{ Customer: stripe.String("{{CUSTOMER_ID}}"), AutomaticTax: &stripe.InvoiceCreateAutomaticTaxParams{Enabled: stripe.Bool(true)}, }; result, err := sc.V1Invoices.Create(context.TODO(), params); ``` Code snippet calling post /v1/invoices in dotnet (resource-based pattern). ```dotnet // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys StripeConfiguration.ApiKey = "sk_test_BQokikJOvBiI2HlWgH4olfQ2"; var options = new InvoiceCreateOptions { Customer = "{{CUSTOMER_ID}}", AutomaticTax = new InvoiceAutomaticTaxOptions { Enabled = true }, }; var service = new InvoiceService(); Invoice invoice = service.Create(options); ``` Code snippet calling post /v1/invoices in dotnet (service-based pattern). ```dotnet // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys var options = new InvoiceCreateOptions { Customer = "{{CUSTOMER_ID}}", AutomaticTax = new InvoiceAutomaticTaxOptions { Enabled = true }, }; var client = new StripeClient("sk_test_BQokikJOvBiI2HlWgH4olfQ2"); var service = client.V1.Invoices; Invoice invoice = service.Create(options); ``` To enable automatic tax calculation when you update an invoice, add the `invoice` parameter alongside `automatic_tax`: Code snippet calling post /v1/invoices/{invoice} in curl (resource-based pattern). ```curl curl https://api.stripe.com/v1/invoices/{{INVOICE_ID}} \ -u "sk_test_BQokikJOvBiI2HlWgH4olfQ2:" \ -d "automatic_tax[enabled]"=true ``` Code snippet calling post /v1/invoices/{invoice} in cli (resource-based pattern). ```cli stripe invoices update {{INVOICE_ID}} \ -d "automatic_tax[enabled]"=true ``` Code snippet calling post /v1/invoices/{invoice} in ruby (resource-based pattern). ```ruby # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys Stripe.api_key = 'sk_test_BQokikJOvBiI2HlWgH4olfQ2' invoice = Stripe::Invoice.update( '{{INVOICE_ID}}', {automatic_tax: {enabled: true}}, ) ``` Code snippet calling post /v1/invoices/{invoice} in ruby (service-based pattern). ```ruby # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys client = Stripe::StripeClient.new("sk_test_BQokikJOvBiI2HlWgH4olfQ2") invoice = client.v1.invoices.update( '{{INVOICE_ID}}', {automatic_tax: {enabled: true}}, ) ``` Code snippet calling post /v1/invoices/{invoice} in python (resource-based pattern). ```python # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys import stripe stripe.api_key = "sk_test_BQokikJOvBiI2HlWgH4olfQ2" invoice = stripe.Invoice.modify( "{{INVOICE_ID}}", automatic_tax={"enabled": True}, ) ``` Code snippet calling post /v1/invoices/{invoice} in python (service-based pattern). ```python # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys client = StripeClient("sk_test_BQokikJOvBiI2HlWgH4olfQ2") invoice = client.invoices.update( "{{INVOICE_ID}}", {"automatic_tax": {"enabled": True}}, ) ``` Code snippet calling post /v1/invoices/{invoice} in php (resource-based pattern). ```php // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys $stripe = new \Stripe\StripeClient('sk_test_BQokikJOvBiI2HlWgH4olfQ2'); $invoice = $stripe->invoices->update( '{{INVOICE_ID}}', ['automatic_tax' => ['enabled' => true]] ); ``` Code snippet calling post /v1/invoices/{invoice} in java (resource-based pattern). ```java // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys Stripe.apiKey = "sk_test_BQokikJOvBiI2HlWgH4olfQ2"; Invoice resource = Invoice.retrieve("{{INVOICE_ID}}"); InvoiceUpdateParams params = InvoiceUpdateParams.builder() .setAutomaticTax(InvoiceUpdateParams.AutomaticTax.builder().setEnabled(true).build()) .build(); Invoice invoice = resource.update(params); ``` Code snippet calling post /v1/invoices/{invoice} in java (service-based pattern). ```java // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys StripeClient client = new StripeClient("sk_test_BQokikJOvBiI2HlWgH4olfQ2"); InvoiceUpdateParams params = InvoiceUpdateParams.builder() .setAutomaticTax(InvoiceUpdateParams.AutomaticTax.builder().setEnabled(true).build()) .build(); Invoice invoice = client.invoices().update("{{INVOICE_ID}}", params); ``` Code snippet calling post /v1/invoices/{invoice} in node (resource-based pattern). ```node // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys const stripe = require('stripe')('sk_test_BQokikJOvBiI2HlWgH4olfQ2'); const invoice = await stripe.invoices.update( '{{INVOICE_ID}}', { automatic_tax: { enabled: true, }, } ); ``` Code snippet calling post /v1/invoices/{invoice} in go (resource-based pattern). ```go // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys stripe.Key = "sk_test_BQokikJOvBiI2HlWgH4olfQ2" params := &stripe.InvoiceParams{ AutomaticTax: &stripe.InvoiceAutomaticTaxParams{Enabled: stripe.Bool(true)}, }; result, err := invoice.Update("{{INVOICE_ID}}", params); ``` Code snippet calling post /v1/invoices/{invoice} in go (service-based pattern). ```go // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys sc := stripe.NewClient("sk_test_BQokikJOvBiI2HlWgH4olfQ2"); params := &stripe.InvoiceUpdateParams{ AutomaticTax: &stripe.InvoiceUpdateAutomaticTaxParams{Enabled: stripe.Bool(true)}, Invoice: stripe.String("{{INVOICE_ID}}"), }; result, err := sc.V1Invoices.Update(context.TODO(), params); ``` Code snippet calling post /v1/invoices/{invoice} in dotnet (resource-based pattern). ```dotnet // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys StripeConfiguration.ApiKey = "sk_test_BQokikJOvBiI2HlWgH4olfQ2"; var options = new InvoiceUpdateOptions { AutomaticTax = new InvoiceAutomaticTaxOptions { Enabled = true }, }; var service = new InvoiceService(); Invoice invoice = service.Update("{{INVOICE_ID}}", options); ``` Code snippet calling post /v1/invoices/{invoice} in dotnet (service-based pattern). ```dotnet // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys var options = new InvoiceUpdateOptions { AutomaticTax = new InvoiceAutomaticTaxOptions { Enabled = true }, }; var client = new StripeClient("sk_test_BQokikJOvBiI2HlWgH4olfQ2"); var service = client.V1.Invoices; Invoice invoice = service.Update("{{INVOICE_ID}}", options); ``` For more information on automatic tax calculation, see [Automatically collect tax on invoices](https://stripe.com/tax/invoicing). ## 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. #### Dashboard 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://stripe.com/invoicing/dashboard#create-invoice). #### API 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://stripe.com/api/customers/create#create_customer-invoice_settings) or [update](https://stripe.com/api/customers/update#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://stripe.com/tax/customer-locations) - [Understand zero tax amounts](https://stripe.com/tax/zero-tax) - [Reporting and filing](https://stripe.com/tax/reports)