action taxrates_tax_rates_by_ip_address { label: "Tax rates by IP address" 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\n

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)

\n\n
var taxrates_endpoint = 'tax/ip';\n  var taxrates_params = {'domain':'api.taxrates.io', 'ip':'208.80.152.201', 'product_code':'C010'};\n  var taxrates_url = '/api/v1/';\n  if ( localStorage.getItem(\"Taxrates_API_Client_Secret\") ){\n  jQuery.support.cors = true;\n  jQuery.ajax({\n      url: taxrates_url+taxrates_endpoint,\n      type: 'get',\n      method: 'get',\n      dataType: \"json\",\n      data: taxrates_params,\n      beforeSend: function (request) {\n              request.withCredentials = true;\n              request.setRequestHeader(\"Authorization\", \"Apikey \" + localStorage.getItem(\"Taxrates_API_Client_Secret\"));\n      },\n      headers: {\n        \"accept\": \"application/json\"\n      },\n      contentType: 'application/json; charset=utf-8',\n      success: function (data) {\n        //Maintain errors inside success because the API may return 200 in general, but different code inside\n          if(data.ErrorCode=='404' || data.ErrorCode=='500'){\n            //Maintain errors here\n            console.log(data.ErrorMessage);\n            return false;\n          }else{\n            var rates = [];\n            var i=0;\n            jQuery.each(data, function(k, v) {\n                if(v.hasOwnProperty(\"taxes\")){\n                    jQuery.each(v.taxes, function(m, w) {\n                        rates[i] = [];\n                        //Only showing standard rate type\n                        if( w.Type == \"standard\" ){\n                            rates[i][0] = w.Country;\n                            rates[i][1] = w.Type;\n                            rates[i][2] = w.data_value;\n                            i++;\n                        }\n                    });\n                }\n            //Now you have all your rates inside rates variable.\n            }).fail(function(xhr) {\n                    //Maintain your errors here\n                    return false;\n            });\n            return true;\n  }else{\n    //Not logged into taxrates.io\n    //Maintain your errors here\n    return false;\n  }
\n" provider: taxrates method: GET path: "/v1/tax/ip" encoding: json input: { type: "object" properties: { domain: { type: "string" } filter: { type: "string" } ip: { type: "string" } product_code: { type: "string" } zip: { type: "string" } } additionalProperties: false } output: { type: "array" items: { type: "object" properties: { country_name: { type: "string" } taxes: { type: "array" items: { type: "object" properties: { Country: { type: "string" } Type: { type: "string" } data_name: { type: "string" } data_value: { type: "string" } } } } } } } }