Tax calculations rounding issue

I’m integrating an app with Square’s Orders API and Payments API and have encountered an issue that I hope you can help with. Despite adjusting my tax calculation rounding function four times to align with Square’s banker’s rounding method, discrepancies still occur. For instance, today a transaction amounted to $18.41, with a tax rate of 9.75%, totaling $1.794975. My function rounded the tax to $1.80, whereas Square rounded it to $1.79.

This inconsistency poses a problem because the Orders API uses my tax calculation to create orders. However, when I attempt to make an external payment using the Payments API, it does not allow me to input my tax calculation. Square recalculates the tax, and if there’s a mismatch, it rejects the payment. This results in businesses not seeing the orders in Square, leading to situations where customers arrive to pick up orders that the shop is unaware of.

Is there a way to push my tax amount through the Payments API, or to prevent payments from being rejected due to mismatched totals? Any advice on handling this would be greatly appreciated.

:wave: I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:

Additional Documentation

Payments Requirements
Payment API: Process Online and In-Person Payments
Collect Application Fees

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.

What’s the order_id that’s causing this error? :slightly_smiling_face:

@Bryan-Square the order I referenced above is 29g86Niu0oZNyzEgCYPyJTa3yXTZY

Hi,
Is there any update on this issue?

Here’s what the Square team noted about this particular instance:

I see 1841 * 0.0975 = 179.4975 cents. And then 179.4975 , being strictly less than 179.5 , rounds down to 179 cents. The rounding only occurs once — it wouldn’t e.g. first round 179.4975 to 179.5 , and then round 179.5 to 180 . It would just round 179.4975 directly to 179 .