GET /v1/tax/ip

taxrates.io

Summary: Tax rates by IP address
Operation ID: taxRatesByIpAddress
Auth: unknown
Description

Get request. This method returns all tax rates for country discovered on either your IP address or IP address param. The IP param is not required. When empty, the taxrates.io will try to discover your IP address and based on this will retrieve the tax rates. You can use 'filter' parameter to narrow results to selected type of tax <p>For US sales tax you can filter the tax rate you want for each state or zip code with one of the following: (they are case sensitive)</p> <ul> <li>CombinedRate</li> <li>StateRate</li> <li>CountyRate</li> <li>CityRate</li> <li>SpecialRate</li> </ul> <pre><code class="js">var taxrates_endpoint = 'tax/ip'; var taxrates_params = {'domain':'api.taxrates.io', 'ip':'208.80.152.201', 'product_code':'C010'}; var taxrates_url = '/api/v1/'; if ( localStorage.getItem("Taxrates_API_Client_Secret") ){ jQuery.support.cors = true; jQuery.ajax({ url: taxrates_url+taxrates_endpoint, type: 'get', method: 'get', dataType: "json", data: taxrates_params, beforeSend: function (request) { request.withCredentials = true; request.setRequestHeader("Authorization", "Apikey " + localStorage.getItem("Taxrates_API_Client_Secret")); }, headers: { "accept": "application/json" }, contentType: 'application/json; charset=utf-8', success: function (data) { //Maintain errors inside success because the API may return 200 in general, but different code inside if(data.ErrorCode=='404' || data.ErrorCode=='500'){ //Maintain errors here console.log(data.ErrorMessage); return false; }else{ var rates = []; var i=0; jQuery.each(data, function(k, v) { if(v.hasOwnProperty("taxes")){ jQuery.each(v.taxes, function(m, w) { rates[i] = []; //Only showing standard rate type if( w.Type == "standard" ){ rates[i][0] = w.Country; rates[i][1] = w.Type; rates[i][2] = w.data_value; i++; } }); } //Now you have all your rates inside rates variable. }).fail(function(xhr) { //Maintain your errors here return false; }); return true; }else{ //Not logged into taxrates.io //Maintain your errors here return false; }</code></pre>

Parameters (5)

domain (string, query, optional)

Domain name: api.taxrates.io

filter (string, query, optional)

For US sales tax you can filter the tax type

ip (string, query, optional)

Customer's IP address

product_code (string, query, optional)

Your can filter your taxes by product code

zip (string, query, optional)

For US sales tax a Zipcode must be proivded

No probe data for this endpoint yet.