Can your online shopping cart handles sales tax? – DEVELOPPARADISE
11/06/2018

Can your online shopping cart handles sales tax?


Sales tax – it’s complex, and only getting more so

Tax calculation can sometimes be an afterthought when you’re developing a complex eCommerce rollout. But given the continuing rise in tax complexity (and the potential end of “tax-free” shopping), it’s a smart first step to figure out how you’re going to calculate sales tax quickly and accurately.

Sales tax is complicated – don’t believe me? Check out this infographic. How complicated? Suppose you’re buying a doughnut in Virginia. That’s not taxable. But if you’re buying five doughnuts? That’s taxable. And what about a candy bar in Indiana – is that taxable? It depends on which candy bar. But what if there’s a drop-shipper involved? You can see where this is going.

Avalara’s API – called AvaTax – handles all the complexity of tax compliance for you, quietly and behind the scenes—reconciling nearly 3,000 different product categories across more than 10,000 separate (but often overlapping) tax jurisdictions, from cities to counties to states to countries.

Our API helps you easily integrate powerful and accurate tax calculations into any accounting system—so instead of worrying about tax compliance, you can focus on making a great eCommerce storefront.

The top 5 reasons to use the AvaTax API

We’re always working to make tax calculations with the AvaTax API as easy and self-serve as possible. Based on what we’ve heard from other developers who work with AvaTax, we think these are the top 5 reasons you’ll love the API:

#1. AvaTax comes with robust developer support.

The AvaTax API has an active developer community, in addition to well-maintained documentation—with “Try It Now” features inline, as well as sandbox and production Swagger UI.

Our API gets a lot of love too, with frequent feature extensions and enhancements. We host regular webinars on patch notes, and we have a sandbox environment that comes out two weeks ahead of production—so you can test any upcoming changes or additional features. We also host weekly, ask-us-anything Office Hours.

#2. You don’t have to build code from the ground up.

Our rigorous documentation has numerous code snippets. We’ve also got a library of the most common programming languages, with multiple SDKs to speed up development (including SDKs for C#, JRE, PHP, Ruby, Python, and JavaScript).

#3. Your tax calculations will be faster and more accurate.

No more messing around with tax tables. If you give us a good address, we give you rooftop-level accuracy for the tax calculation, based on the state/province, county, special tax jurisdiction, and the item code (i.e., what you’re selling).

We have a huge content team that’s constantly working with tax jurisdictions around the world to keep everything accurate and up to date—no matter how many doughnuts you’re selling in Virginia.

#4. It’s easy to integrate with existing financial applications.

AvaTax gets along well with most ERP, CRM, and billing systems. Our REST API lets you write custom integrations, but we also have more than 600 existing connectors that use the API.

#5. AvaTax is highly customizable.

We can fit into your workflow and checkout process wherever it makes sense—whether that’s providing tax estimates before the customer finalizes their order, accounting for drop-shipping, or maintaining multiple locations (including points of receipt, points of delivery, or multiple companies under one account).

We’ve also built our API to handle customization situations that you might not have even thought of yet. For example, AvaTax makes it easy to backdate or quickly refund transactions, and you can process multiple line items with one API call (i.e., giving you line-item granularity for your tax calculation, rather than the subtotal level). The API can even handle “tax included” pricing, by calculating tax based on the final price.

How to get started with AvaTax and your eCommerce storefront

Before you connect your shopping cart to the AvaTax tax engine, the first step is to make sure there’s not already a connector for the platform you’re using. As mentioned above, there are more than 600 existing, easy-to-use AvaTax connectors—including for popular eCommerce platforms like Magento, nopCommerce, PrestaShop, and Shopify. Consult your shopping cart support documentation to see if you already have a connector.

If not, no problem. Let us walk you through the implementation of a sample U.S. sale:

AvaTax request and response: step by step

Avalara’s API can calculate a wide range of taxes for goods, accounting for the taxability of each line item in your transaction.

Let’s start with a basic example: a sale in Washington State and shipped to New York State. The CreateTransactionModel is used to submit a document to AvaTax for calculation. Here’s a tax request for shipping a $100 order of yarn to New York:

POST /api/v2/transactions/create {  "lines": [    {      "number": "1",      "quantity": 1,      "amount": 100,      "taxCode": "PS081282",      "itemCode": "Y0001",      "description": "Yarn"    },    {      "number": "2",      "quantity": 1,      "amount": 5,      "taxCode": "FR010000",      "itemCode": "SHIP001",      "description": "Shipping"    }   ],  "type": "SalesInvoice",  "companyCode": "DEFAULT",  "date": "2018-04-25",  "customerCode": "ABC",  "purchaseOrderNo": "2018-04-25-001",  "addresses": {    "shipFrom": {      "line1": "895 1st Ave",      "city": "Seattle",      "region": "WA",      "country": "US",      "postalCode": "98104"    },    "shipTo": {      "line1": "14 Lawton Rd",      "city": "Wappingers Falls",      "region": "NY",      "country": "US",      "postalCode": "12590"    }  },  "commit": true,  "currencyCode": "USD",  "description": "Yarn" }

In the request above, our first LineItemModel includes the taxCode PS081282 for yarn. The taxCode field is optional; if you leave this field blank or null, AvaTax will calculate tax based on a default code of P0000000—but using a specific, applicable code will give you the most accurate tax calculation for the goods you are shipping. You can use the ListTaxCodes API to search for tax codes specific to your products.

Since shipping is taxable in some jurisdictions, the shipping cost is also included in the example LineItemModels. The field and value “type”: “SalesInvoice” denotes that this transaction is considered revenue received.

When goods are shipped to a different location, use a shipFrom and shipTo AddressesModel. Another potential use of the Addresses field is singleLocation, which applies to situations where purchase and delivery occur at the same location, such as a retail storefront.

AvaTax takes the complexities of tax calculation around the world and makes it painless with one simple request. The example request above calculates the taxes for the three applicable New York jurisdictions: State, County, and the Metro North Special Taxing Jurisdiction. You can try this out for yourself using the CreateTransaction Try Now feature. This feature is available on almost all of the AvaTax API reference pages.

For the example request, there’s a lot of detail returned in the response—more than 500 lines. For the sake of brevity, let’s look at the summary, which contains a lot of relevant information:

{  …  "summary": [    {      "country": "US",      "region": "NY",      "jurisType": "State",      "jurisCode": "36",      "jurisName": "NEW YORK",      "taxAuthorityType": 45,      "stateAssignedNo": "",      "taxType": "Use",      "taxName": "NY STATE TAX",      "rateType": "General",      "taxable": 105,      "rate": 0.04,      "tax": 4.2,      "taxCalculated": 4.2,      "nonTaxable": 0,      "exemption": 0    },    {      "country": "US",      "region": "NY",      "jurisType": "County",      "jurisCode": "027",      "jurisName": "DUTCHESS",      "taxAuthorityType": 45,      "stateAssignedNo": "DU 1311",      "taxType": "Use",      "taxName": "NY COUNTY TAX",      "rateType": "General",      "taxable": 105,      "rate": 0.0375,      "tax": 3.94,      "taxCalculated": 3.94,      "nonTaxable": 0,      "exemption": 0    },    {      "country": "US",      "region": "NY",      "jurisType": "Special",      "jurisCode": "359070",      "jurisName": "DUTCHESS CO TRANSIT DISTRICT",      "taxAuthorityType": 45,      "stateAssignedNo": "DU 1311",      "taxType": "Use",      "taxName": "NY SPECIAL TAX",      "rateType": "General",      "taxable": 105,      "rate": 0.00375,      "tax": 0.4,      "taxCalculated": 0.4,      "nonTaxable": 0,      "exemption": 0    }  ],  "parameters": {} }

In the response, we can see that AvaTax determined this is a destination-based tax calculation—i.e., taxes are calculated at the place of delivery. For some jurisdictions (such as Arizona, California, and Virginia), tax is calculated based on the place of the sale, rather than where it is going. (Read more about the destination and origin sales tax in this white paper.)

We know there are three applicable taxing jurisdictions for this shipment to New York, which you can see from the taxable field. The summary here shows the New York State, Dutchess County, and special “transit district” taxes, rates, and calculations for the subtotal of $105. Some jurisdictions and transactions have tax-on-tax scenarios, but fortunately AvaTax can handle those, too, with one request.

Ready to try AvaTax yourself?

Tax calculation is complicated, but the AvaTax API can save you time, money, and headaches when you’re setting up a storefront. To explore the AvaTax API yourself, sign up for a free 60-day production account.

Have more questions? Head to developer.avalara.com or join our weekly Office Hours.

Learn more

Check out our Developer Guide for more information. A great place to start is with our many “Try It Now” features: