Scope
Round off difference in CB and Xero
Solution
While most round-offs are approximately 0.01 and are there to offset the difference in how Chargebee and Xero perform a rounding; sometimes it can be because of how Chargebee has different Pricing Models. (Reference https://www.chargebee.com/docs/2.0/plans.html#pricing-models)
This is best explained with an example.
If an invoice has a tiered pricing structure where
0 to 50 units; the rate is 0.0
51 and above; the rate is 0.22
The invoice has a quantity of 75. Which means,
The first 50 units are 0.00
The next 25 units are 25 * 0.22 = 5.50
Now Xero does not have a tiered pricing structure.
Instead, Xero has a straight rate * qty.
When we pass the line item to Xero; we calculate the rate as follows :
Rate = {Line Amount}/{total quantity}
I.e. Rate = 5.5/75 = 0.0733333
I.e. Rate is approximately equal to 0.07
So when we pass this line item to Xero; it will calculate as follows :
Rate = 0.07
Qty = 75
Amount = Rate * Qty = 75 * 0.07 = 5.25
Due to the above discrepancy, we send a roundoff to make sure the totals match on both Chargebee and Xero.
We will not be able to match each individual line item amount or tax amount because of the difference in calculation methodology between Chargebee and Xero.