Critical error when using Order api data to sum tax to pay in a 2 tiered tax system eg GST, PST

Critical error when using Order api data to sum tax to pay in a 2 tiered tax system eg GST, PST

Neil_Bragg
Shopify Partner
5 0 1

Read below to discover why you are likely paying wrong taxes to your two governments!

 

I use the Order api to import data into a spreadsheet in order to sum and pay Tax. In my country, tax is paid to both the federal and provincial (state) governments ie its a 2 tiered system and hence I receive 2 tax_lines in the order object (see below).

 

Shown below is the data from 2 consecutive orders and you can see that there is inconsistency in the position each tier (type) of tax holds in the array. ie the federal tax ("GST") is in 1st array element in the first order whereas in the 2nd order (see below) it is in the 2nd array element! There is no pattern to this ... shopify swaps them around, at will, from one order to the next. This has been the case only since the beginning of April, 2021.

 

 

This is a huge problem as (without further coding) you are most probably summing the tax from differing tiers into the same total and wrongly calculating (and paying) the tax you owe to your two governments!

 

Data for order 1 (with the federal tax ("GST") in the 1st array element)

 "orders":[

  {

   "tax_lines":[
    {
     "price":"10.13",
     "rate":0.05,
     "title":"GST", {this is clearly the 1st array element and it contains the tax amt to pay to the federal government} 
     "price_set":{
      "shop_money":{"amount":"10.13","currency_code":"CAD"},
      "presentment_money":{"amount":"10.13","currency_code":"CAD"}
     },
     "channel_liable":false
    },
    {
     "price":"20.20",
     "rate":0.09975,
     "title":"QST", {in the 2nd array element Shopify has put the tax to be paid to the 2nd tier of government, no problem, yet, but see the next order below}
     "price_set":{
      "shop_money":{"amount":"20.20","currency_code":"CAD"},

      "presentment_money":{"amount":"20.20","currency_code":"CAD"}
     },
     "channel_liable":false
    }
   ]
  }
 ]

Data for the very next order with the 1st tier of tax ("GST") this time in the 2nd array element!

 "orders":[
  {
   "tax_lines":[
    {
     "price":"37.91",
     "rate":0.09975,
     "title":"QST", {here is the very next order with the provincial tax swapped into the first array element}
     "price_set":{
      "shop_money":{"amount":"37.91","currency_code":"CAD"},
      "presentment_money":{"amount":"37.91","currency_code":"CAD"}
     },
     "channel_liable":false
    },
    {
     "price":"19.00",
     "rate":0.05,
     "title":"GST"{here, in this 2nd order, the first tier of tax to be paid to the federal government is the 2nd array element and will, therefore, be added into the wrong total} 
     "price_set":{
      "shop_money":{"amount":"19.00","currency_code":"CAD"},
      "presentment_money":{"amount":"19.00","currency_code":"CAD"}
     },
     "channel_liable":false
    }
   ]
  }
 ]

Replies 0 (0)