I want to include the VAT in the price of a line item.
My solution is to:
-
Set the price of the item to its actual price ($2990) divided by 1.06.
-
Add an object to the “taxes” array and set its rate to 6.
import { invoices } from 'wix-billing-backend';
export function create() {
invoices.createInvoice({
...
lineItems: [{
id: '0',
name: "Line Item",
quantity: 1,
price: 2990 / 1.06,
taxes: [{
name: "VAT",
rate: 6,
code "VAT"
}]
}]
});
This works sometimes, with some prices. However, in this case, I get this error:
balance USD -0.01 must be non negative
How do I approach rounding in Velo and JS?