FileMaker tips, techniques, and news.

By Brendan McBride  Posted on  April 2nd, 2015  in  FileMaker, Free Downloads

FileMaker Avalara Sales Tax Integration

Finding the tax rate for an address can prove to be quite tricky. The sales tax can vary based on the jurisdiction of the location where some states have a statewide sales tax. Integrating FileMaker with a web service to automatically find the sales tax will take a lot of the guesswork out of running your business.

Sales Tax Through Geolocation

When searching for the web service you would like to use, you will want to make sure you find one that allows you to get the tax rate using an address or latitude and longitude. Most web services offer a look-up based on a zip code, however, oftentimes that will return an inaccurate sales tax because a specific zip code can have multiple jurisdictions within it. In our example, we are using the free service from the Avalara Tax Rates API in order to find the sales tax from a specific street address. This API will translate an address to geographic coordinates behind the scenes in order to provide the most accurate tax rate for that address. However, if your tax needs are more complex, Avalara does provide other services.

Integrate With FileMaker

In order to find the sales tax for an address in FileMaker, you will need to register with Avalara in order to receive your API key. The API key is what you will pass to Avalara in order for Avalara to recognize you as a user, so treat this key like a password. Once you have the key, you will need to build a URL query to request the sales tax from Avalara using the FileMaker script step Insert from URL. You will also want to make sure that the parameters within your URL are encoded using the FileMaker function GetAsURLEncoded(). Feel free to check out the Avalara Tax Rate API documentation to see how to build the URL.

Once the URL has been built, the request will return JSON-encoded text, which will include the total tax rate for that address and all of the jurisdictions that make up the total tax rate. FileMaker does not have a native way to decode JSON-encoded text, but you can simply text parse the response, as it is not overly complex. You may also use the BaseElements Plugin , which has a function just for JSON text parsing, JSONPath.


CreateTransaction Endpoint

For paying customers, Avalara offers more powerful endpoints for tax calculation. Similar to the free AvaTax API above, the CreateTransaction endpoint will calculate sales tax based on an address. Unlike the free API, the CreateTransaction endpoint will return the amount of tax owed on a transaction, keep records of every transaction and tax calculation, allow you to specify tax jurisdictions for an address manually, and more. 

 

Unlike the free AvaTax endpoint, data is sent as a JSON object along with your other cURL options. Multiple taxable items can be included in one transaction. Just like before, the Insert from URL script step is used.

Because you have the option to include taxable items and their prices in the data JSON object, Avalara will return the amount of tax owed on the transaction along with a breakdown of which tax jurisdictions contribute to the total tax amount in JSON encoded format. Using the JSONGetElement( ) function in FileMaker to parse relevant data is fairly straight forward. For a tax rate calculation like this, you would pull the rate value in each item of the details (tax jurisdictions) arrays within each of the line objects as shown above. 


Did you know we are an authorized reseller for FileMaker Licensing?
Contact us to discuss upgrading your FileMaker software.

Download
Download the FileMaker Avalara Sales Tax Integration File
Please complete the form below to download your FREE FileMaker file.
FileMaker Experience *
Terms of Use *
OPT-IN: I agree that I am downloading a completely free FileMaker application file with no strings attached. This file is unlocked, and I may use it for my business or organization as I see fit. Because I am downloading a free file, I agree that I should receive occasional marketing. I understand that I can OPT-OUT of these emails at anytime.
Brendan McBride thumbnail
Brendan McBride

Brendan is a certified FileMaker and web developer and is a very friendly, hard-working, and technically-astute engineer ready to solve any problem you throw at him. Brendan went to Purdue, receiving a Bachelors in Computer Science and minored in Economics.