I need to get the sales tax for each location. I haven’t found a way to do this through the API. Sales tax is assigned per location in the square dashboard. Is it possible to retrieve sales tax per location via the API?
Taxes are catalog objects, so they can be found using the Catalog API. Unfortunately, there’s no way to filter by location explicitly when calling ListCatalog
, but you’ll be able to see which location each tax belongs to in the response.
Thanks @sjosey.
Here’s the response I got:
{
"objects": [
{
"type": "TAX",
"id": "HWTI33ECRV6HNQXTTVJTZF3E",
"updated_at": "2019-07-01T12:20:54.129Z",
"version": 1561983654129,
"is_deleted": false,
"catalog_v1_ids": [
{
"catalog_v1_id": "89E6DD32-EDA1-449C-A464-920DA5593005",
"location_id": "CJKHHFZX3XJEF"
}
],
"present_at_all_locations": false,
"present_at_location_ids": [
"CJKHHFZX3XJEF",
"J2XWVZW813V8E"
],
"tax_data": {
"name": "Sales Tax (DC)",
"calculation_phase": "TAX_SUBTOTAL_PHASE",
"inclusion_type": "ADDITIVE",
"percentage": "10.0",
"applies_to_custom_amounts": true,
"enabled": true,
"tax_type_id": "us_sales_tax",
"tax_type_name": "Sales Tax"
}
},
{
"type": "TAX",
"id": "XV4E4UTJCS2IYC6FYKRTPOK6",
"updated_at": "2019-07-01T12:21:00.774Z",
"version": 1561983660774,
"is_deleted": false,
"present_at_all_locations": true,
"absent_at_location_ids": [
"CJKHHFZX3XJEF",
"J2XWVZW813V8E"
],
"tax_data": {
"name": "Sales Tax (MD)",
"calculation_phase": "TAX_SUBTOTAL_PHASE",
"inclusion_type": "ADDITIVE",
"percentage": "6.0",
"applies_to_custom_amounts": true,
"enabled": true,
"tax_type_id": "us_sales_tax",
"tax_type_name": "Sales Tax"
}
}
]
}
This shape would make it hard to find the taxes at all of the locations because when present_at_all_locations
is true, the location ids are located under a present_at_location_ids
property, but when it’s false, they’re under a absent_at_location_ids
property. This seems to be because one of the taxes has “Available at all future locations” selected in the dashboard, and the other one doesn’t. I’m not clear on what selecting this option in the dashboard actually does, because the tax that does NOT have “Available at all future locations” selected still seems to be available at the other locations anyway. Can you let me know how this should work? It seems to me that it would be best to have the same option selected for all taxes, otherwise it will be difficult to parse the response.
Most likely the XV4E4UTJCS2IYC6FYKRTPOK6
was created with all locations checked (which makes present_at_all_locations==true
, and later unchecked at locations CJKHHFZX3XJEF
and J2XWVZW813V8E
. “Available at all future locations” implies when you create a new location it will automatically be enabled. If you want to make them the same, you could update them via the API and change one to true/false, depending on your preference, and then add/remove the present_...
or absent_...
attributes.