CData Python Connector for TaxJar

Build 24.0.9060

CalculateTaxes

Shows the sales tax that should be collected for a given order.

Calculate Taxes

To calculate taxes for a given order the CalculateTaxes stored procedure must be called. To make a CalculateTaxes SP call please specify at least ToCountry and Shipping parameters.

Note: For adding more than one values to "NexusAddresses" and "LineItems", you can use the NexusAddresses#TEMP and LineItems#TEMP tables or create the JSON structure to provide the values to insert.

In order to avoid errors please follow the conditions for a successful SP call enforced by the TaxJar API:

  • If ToCountry is set to US, ToZIP is required.
  • If ToCountry is set to US or CA, ToState is required.
  • If any NexusAddresses is provided, NexusAddressesCountry and NexusAddressesState is required.
  • Specify either Amount or LineItems to perform tax calculations.

  EXEC CalculateTaxes
  @FromCountry = 'US',
  @FromZip = '92093',
  @FromState = 'CA',
  @FromCity = 'La Jolla',
  @FromStreet = '9500 Gilman Drive',
  @ToCountry = 'US',
  @ToZip = '90002',
  @ToState = 'CA',
  @ToCity = 'Los Angeles',
  @ToStreet = '1335 E 103rd St',
  @Amount = '15',
  @Shipping = '1.5',
  @NexusAddressId = 'Main Location',
  @NexusAddressCountry = 'US',
  @NexusAddressZip = '92093',
  @NexusAddressState = 'CA',
  @NexusAddressCity = 'La Jolla',
  @NexusAddressStreet = '9500 Gilman Drive'

  INSERT INTO NexusAddresses#TEMP (NexusAddressID, NexusAddressCountry, NexusAddressZip, NexusAddressState, NexusAddressCity, NexusAddressStreet) VALUES ('Main Location', 'US', '92093', 'CA', 'La Jolla', '9500 Gilman Drive')
  INSERT INTO NexusAddresses#TEMP (NexusAddressID, NexusAddressCountry, NexusAddressZip, NexusAddressState, NexusAddressCity, NexusAddressStreet) VALUES ('Main Location 2', 'US', '92093', 'CA', 'La Jolla 2', '9500 Gilman Drive 2')
  INSERT INTO LineItems#TEMP (LineItemId, LineItemQuantity, LineItemProductTaxCode, LineItemUnitPrice, LineItemDiscount) VALUES ('1', '1', '20010', '15', '0')
  
  EXEC CalculateTaxes
  @FromCountry = 'US',
  @FromZip = '92093',
  @FromState = 'CA',
  @FromCity = 'La Jolla',
  @FromStreet = '9500 Gilman Drive',
  @ToCountry = 'US',
  @ToZip = '90002',
  @ToState = 'CA',
  @ToCity = 'Los Angeles',
  @ToStreet = '1335 E 103rd St',
  @Amount = '15',
  @Shipping = '1.5',
  @NexusAddresses = 'NexusAddresses#TEMP',
  @LineItems = 'LineItems#TEMP'

  EXEC CalculateTaxes
  @FromCountry = 'US',
  @FromZip = '92093',
  @FromState = 'CA',
  @FromCity = 'La Jolla',
  @FromStreet = '9500 Gilman Drive',
  @ToCountry = 'US',
  @ToZip = '90002',
  @ToState = 'CA',
  @ToCity = 'Los Angeles',
  @ToStreet = '1335 E 103rd St',
  @Amount = '15',
  @Shipping = '1.5',
  @NexusAddresses = '[{"NexusAddressId":"Main Location","NexusAddresscountry":"US","NexusAddresszip":"92093","NexusAddressstate":"CA","NexusAddresscity":"La Jolla","NexusAddressstreet":"9500 Gilman Drive"},{"NexusAddressid":"Main Location 2","NexusAddresscountry":"US","NexusAddresszip":"92093","NexusAddressstate":"CA","NexusAddresscity":"La Jolla 2","NexusAddressstreet":"9500 Gilman Drive 2"}]',
  @LineItems = '[{"LineItemid":"1","LineItemquantity":"1","LineItemproducttaxcode":"20010","LineItemunitprice":"15","LineItemdiscount":"0"}]'

Input

Name Type Required Description
FromCountry String False Two-letter ISO country code of the country where the order shipped from. View Note
FromZip String False Postal code where the order shipped from (5-Digit ZIP or ZIP+4).
FromState String False Two-letter ISO state code where the order shipped from.
FromCity String False City where the order shipped from.
FromStreet String False Street address where the order shipped from.
ToCountry String True Two-letter ISO country code of the country where the order shipped to.
ToZip String False Postal code where the order shipped to (5-Digit ZIP or ZIP+4).
ToState String False Two-letter ISO state code where the order shipped to.
ToCity String False City where the order shipped to.
ToStreet String False Street address where the order shipped to. View Note
Amount Double False Total amount of the order, excluding shipping. View Note
Shipping Double True Total amount of shipping for the order.
CustomerId String False Unique identifier of the given customer for exemptions.
ExemptionType String False Type of exemption for the order: wholesale, government, marketplace, other, or non_exempt.
NexusAddressId String False Unique identifier of the given nexus address. This column input will not be accepted if NexusAddresses column is added.
NexusAddressCountry String False Two-letter ISO country code for the nexus address. This column input will not be accepted if NexusAddresses column is added.
NexusAddressZip String False Postal code for the nexus address. This column input will not be accepted if NexusAddresses column is added.
NexusAddressState String False Two-letter ISO state code for the nexus address. This column input will not be accepted if NexusAddresses column is added.
NexusAddressCity String False City for the nexus address. This column input will not be accepted if NexusAddresses column is added.
NexusAddressStreet String False Street address for the nexus address. This column input will not be accepted if NexusAddresses column is added.
NexusAddresses String False The aggregate for Nexus Addresses.
LineItemId String False Unique identifier of the given line item. This column input will not be accepted if LineItems column is added.
LineItemQuantity Integer False Quantity for the item. This column input will not be accepted if LineItems column is added.
LineItemProductTaxCode String False Product tax code for the item. This column input will not be accepted if LineItems column is added.
LineItemUnitPrice Double False Unit price for the item. This column input will not be accepted if LineItems column is added.
LineItemDiscount Double False Total discount (non-unit) for the item. This column input will not be accepted if LineItems column is added.
LineItems String False The aggregate for Line Items.

Result Set Columns

Name Type Description
OrderTotalAmount Double Total amount of the order.
Shipping Double Total amount of shipping for the order.
TaxableAmount Double Amount of the order to be taxed.
AmountToCollect Double Amount of sales tax to collect.
Rate Double Overall sales tax rate of the order (amount_to_collect รท taxable_amount).
HasNexus Bool Whether or not you have nexus for the order based on an address on file, nexus_addresses parameter, or from_ parameters.
FreightTaxable Bool Freight taxability for the order.
TaxSource String Origin-based or destination-based sales tax collection.
ExemptionType String Type of exemption for the order: wholesale, government, marketplace, other, or non_exempt. If no customer_id or exemption_type is provided, no exemption_type is returned in the response.
JurisdictionAggregate String Jurisdiction names for the order.
BreakdownAggregate String Breakdown of rates by jurisdiction for the order, shipping, and individual line items. If has_nexus is false or no line items are provided, no breakdown is returned in the response.

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 24.0.9060