I have an order with the following items and discount of $2.38. However, on sending clover line item discounts (since one of the order items doesn't need to be discounted), the calculated discount becomes different in value.

Please confirm the Clover side calculation: [Item1 = $8.99], [Item2 = $6.99], [Item 3 = $6.99 + modifiers as m1 = $0.25, m2 = $0.5], [Item4 = $1.20]. Total discount is $2.38 and has to applied to all items except item4.

If I proportionately distribute discount to all line items1-3 but do roundups to 2 decimal places each time, the total discount applied becomes $2.42 not $2.38.

Sum of all items to be discounted = $23.72 = 8.99+6.99+6.99+0.25+0.50 Discount = $2.38 Item1 discount = $0.91 = 8.99 * 2.38 / 23.72. Similarly, Item2 discount = $0.71, Item3's = $.80 = ($0.71+$0.03+$0.06)

Total discount = $2.42 = $0.91+0.71+0.80

The rounding up is causing the error. What can be done in this case to ensure total discount sent is what is applied?