Serious bug with discount codes: "Value must not have more than 2 decimal positions"

Hi,
I was finally able to debug a problem causing an endless “preparing payment” spinner.

We have a product with included taxes (22%) for 14.99.
We also created a discount code with these settings: “Offer free products when a customer buys a specified quantity of a product”, required items 3, free items 1.

When this coupon is applied, the system fails with this error:

Items[5].UnitPriceAmount: [“Value must not have more than 2 decimal positions”].

The sixth item in the array is in fact the discount code, which is calculated as -12.28688524590164, causing the call to payment.snipcart.com/api/public/sessions to fail with a 400 bad request.

I’m attaching a few screenshots.

Hope this helps solving the issue on your end.


Cheers,
Andrea

Thanks for the details @azicchetti we’ll look into it.