Question

Rounding errors when using BigCommerce orders to make Xero invoices

  • 31 August 2021
  • 1 reply
  • 106 views

I have a Zap integration working between BigCommerce and Xero.   I have a trigger setup on BigCommerce for “Waiting Fulfilment” orders to create an Invoice in Xero.

The problem is that I’m getting rounding errors where in some cases (when the order has multiple items) the invoice total in Xero is out by a few pence/cents vs. the bigcommerce order.

I think I’ve narrowed down the issue to the fact that Bigcommerce calculates its total using a unit price accurate to four decimal places,  whereas the default setting on the Xero API only has the unit price accurate to two decimal places.  See screenshots attached.

According to Xero documentation,   in order to get the default unit precision increased from two decimal places to four decimal places,  I need to append the API request with ?unitdp=4

e.g. PUT and POST invoices - https://api.xero.com/api.xro/2.0/Invoices?unitdp=4 PUT and POST items - https://api.xero.com/api.xro/2.0/Items?unitdp=4

Is it possible to somehow trick the Zapier integration into putting the ?unitdp=4 into the API request? OR do I need to create a brand new Xero integration from scratch in order to achieve this?  OR any other ideas on how to solve my rounding problem?

Your help is much appreciated.


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

1 reply

Userlevel 7
Badge +14

Hi @FFE 

The Xero API can be used in Zaps with the Webhooks app or Code app as an action step.

Xero API: https://developer.xero.com/

Webhooks: https://zapier.com/apps/webhook/integrations

Code: https://zapier.com/apps/code/help