Calculates tax based on the input and returns a Tax Calculation
object.
Parameters
- currencyenumRequired
Three-letter ISO currency code, in lowercase. Must be a supported currency.
- line_
itemsarray of objectsRequired A list of items the customer is purchasing.
- line_items.
amountintegerRequired A positive integer representing the line item’s total price in the smallest currency unit. If
tax_
, then this amount includes taxes. Otherwise, taxes are calculated on top of this amount.behavior=inclusive - line_items.
productstring If provided, the product’s
tax_
will be used as the line item’scode tax_
.code - line_items.
quantityinteger The number of units of the item being purchased. Used to calculate the per-unit price from the total
amount
for the line. For example, ifamount=100
andquantity=4
, the calculated unit price is 25. - line_items.
referencestringRequired A custom identifier for this line item, which must be unique across the line items in the calculation. The reference helps identify each line item in exported tax reports.
- line_items.
tax_ behaviorenum Specifies whether the
amount
includes taxes. Defaults toexclusive
.Possible enum valuesexclusive
Taxes are calculated on top of the line item amount (default).
inclusive
Taxes are included in the line item amount.
- line_items.
tax_ codestring A tax code ID to use for this line item. If not provided, we will use the tax code from the provided
product
param. If neithertax_
norcode product
is provided, we will use the default tax code from your Tax Settings.
- customer_
detailsobjectRequired unless customer provided Details about the customer, including address and tax IDs.
- customer_details.
addressobjectRequired unless ip_address provided The customer’s postal address (for example, home or business location).
- customer_details.
address. countrystringRequired Two-letter country code (ISO 3166-1 alpha-2).
- customer_details.
address. citystring City, district, suburb, town, or village.
- customer_details.
address. line1string Address line 1 (e.g., street, PO Box, or company name).
- customer_details.
address. line2string Address line 2 (e.g., apartment, suite, unit, or building).
- customer_details.
address. postal_ codestringRequired for us addresses ZIP or postal code.
- customer_details.
address. statestring State, county, province, or region. We recommend sending ISO 3166-2 subdivision code value when possible.
- customer_details.
address_ sourceenumRequired when using address The type of customer address provided.
Possible enum valuesbilling
Denotes the address as billing address.
shipping
Denotes the address as shipping address.
- customer_details.
ip_ addressstringRequired unless address provided The customer’s IP address (IPv4 or IPv6).
- customer_details.
tax_ idsarray of objects The customer’s tax IDs. Stripe Tax might consider a transaction with applicable tax IDs to be B2B, which might affect the tax calculation result. Stripe Tax doesn’t validate tax IDs for correctness.
- customer_details.
tax_ids. typestringRequired Type of the tax ID, one of
ad_
,nrt ae_
,trn ar_
,cuit au_
,abn au_
,arn bg_
,uic bh_
,vat bo_
,tin br_
,cnpj br_
,cpf by_
,tin ca_
,bn ca_
,gst_ hst ca_
,pst_ bc ca_
,pst_ mb ca_
,pst_ sk ca_
,qst ch_
,uid ch_
,vat cl_
,tin cn_
,tin co_
,nit cr_
,tin de_
,stn do_
,rcn ec_
,ruc eg_
,tin es_
,cif eu_
,oss_ vat eu_
,vat gb_
,vat ge_
,vat hk_
,br hr_
,oib hu_
,tin id_
,npwp il_
,vat in_
,gst is_
,vat jp_
,cn jp_
,rn jp_
,trn ke_
,pin kr_
,brn kz_
,bin li_
,uid ma_
,vat md_
,vat mx_
,rfc my_
,frp my_
,itn my_
,sst ng_
,tin no_
,vat no_
,voec nz_
,gst om_
,vat pe_
,ruc ph_
,tin ro_
,tin rs_
,pib ru_
,inn ru_
,kpp sa_
,vat sg_
,gst sg_
,uen si_
,tin sv_
,nit th_
,vat tr_
,tin tw_
,vat tz_
,vat ua_
,vat us_
,ein uy_
,ruc uz_
,tin uz_
,vat ve_
,rif vn_
, ortin za_
vat - customer_details.
tax_ids. valuestringRequired Value of the tax ID.
- customer_details.
taxability_ overrideenum Overrides the tax calculation result to allow you to not collect tax from your customer. Use this if you’ve manually checked your customer’s tax exemptions. Prefer providing the customer’s
tax_
where possible, which automatically determines whetherids reverse_
applies.charge Possible enum valuescustomer_
exempt The customer is exempt of tax.
none
No taxability override (default).
reverse_
charge The customer is entitled to reverse charge tax treatment.
- shipping_
costobject Shipping cost details to be used for the calculation.
- shipping_cost.
amountintegerRequired unless shipping_rate provided A positive integer in the smallest currency unit representing the shipping charge. If
tax_
, then this amount includes taxes. Otherwise, taxes are calculated on top of this amount.behavior=inclusive - shipping_cost.
shipping_ ratestringRequired unless amount provided If provided, the shipping rate’s
amount
,tax_
andcode tax_
are used. If you provide a shipping rate, then you cannot pass thebehavior amount
,tax_
, orcode tax_
parameters.behavior - shipping_cost.
tax_ behaviorenum Specifies whether the
amount
includes taxes. Iftax_
, then the amount includes taxes. Defaults tobehavior=inclusive exclusive
.Possible enum valuesexclusive
Taxes are calculated on top of the line item amount (default).
inclusive
Taxes are included in the line item amount.
- shipping_cost.
tax_ codestring The tax code used to calculate tax on shipping. If not provided, the default shipping tax code from your Tax Settings is used.
More parameters
- customerstringRequired unless customer_details provided
The ID of an existing customer to use for this calculation. If provided, the customer’s address and tax IDs are copied to
customer_
.details - ship_
from_ detailsobject Details about the address from which the goods are being shipped.
- ship_from_details.
addressobjectRequired The address from which the goods are being shipped from.
- ship_from_details.
address. countrystringRequired Two-letter country code (ISO 3166-1 alpha-2).
- ship_from_details.
address. citystring City, district, suburb, town, or village.
- ship_from_details.
address. line1string Address line 1 (e.g., street, PO Box, or company name).
- ship_from_details.
address. line2string Address line 2 (e.g., apartment, suite, unit, or building).
- ship_from_details.
address. postal_ codestringRequired for us addresses ZIP or postal code.
- ship_from_details.
address. statestring State/province as an ISO 3166-2 subdivision code, without country prefix. Example: “NY” or “TX”.
- tax_
dateinteger Timestamp of date at which the tax rules and rates in effect applies for the calculation. Measured in seconds since the Unix epoch. Can be up to 48 hours in the past, and up to 48 hours in the future.
Returns
A Tax Calculation
object containing the first 100 input line_
if the calculation succeeds. Otherwise, an error (for example, indicating that the customer address was invalid).
{ "id": "taxcalc_1OduxkBUZ691iUZ4iWvpMApI", "object": "tax.calculation", "amount_total": 1953, "currency": "usd", "customer": null, "customer_details": { "address": { "city": "Seattle", "country": "US", "line1": "920 5th Ave", "line2": null, "postal_code": "98104", "state": "WA" }, "address_source": "shipping", "ip_address": null, "tax_ids": [], "taxability_override": "none" }, "expires_at": 1706708005, "line_items": { "object": "list", "data": [ { "id": "tax_li_PSqf3RMNZa23H4", "object": "tax.calculation_line_item", "amount": 1499, "amount_tax": 154, "livemode": false, "product": null, "quantity": 1, "reference": "Music Streaming Coupon", "tax_behavior": "exclusive", "tax_code": "txcd_10000000" } ], "has_more": false, "total_count": 1, "url": "/v1/tax/calculations/taxcalc_1OduxkBUZ691iUZ4iWvpMApI/line_items" }, "livemode": false, "ship_from_details": null, "shipping_cost": { "amount": 300, "amount_tax": 0, "tax_behavior": "exclusive", "tax_code": "txcd_92010001" }, "tax_amount_exclusive": 154, "tax_amount_inclusive": 0, "tax_breakdown": [ { "amount": 154, "inclusive": false, "tax_rate_details": { "country": "US", "percentage_decimal": "10.25", "state": "WA", "tax_type": "sales_tax" }, "taxability_reason": "standard_rated", "taxable_amount": 1499 }, { "amount": 0, "inclusive": false, "tax_rate_details": { "country": "DE", "percentage_decimal": "0.0", "state": null, "tax_type": "vat" }, "taxability_reason": "zero_rated", "taxable_amount": 300 } ], "tax_date": 1706535204}