Apply Tax while creating Invoice from API

Hi,

I am creating invoice via API, I am adding 20% tax while creating it, Amount passing in the cost is including tax, but its applying the tax again. If I deduct the tax value from the original amount and pass, it applying vat to that amount, so total amount is showing incorrect.

Is there any option to pass the tax amount and cost from the API. so its shows correct value in the PDF.

Thanks

Hi,

Sorry, I’m not sure I understand. If you want to share an example request it may help.

Note: you can use the network tab in the browser console to inspect the API requests made by the app.

I am creating invoice via API, adding tax in the invoice, in line item i am passing the cost.
for example my amount is 100 inclusive VAT. when i send it, its again calculating vat on 100 so total is incorrect. If i deduct the amount of tax like 100 -20= 80, if i pass 80 its calculating VAT on it, so than also total is incorrect.

just want to check if there is any parameter where in the json where i can pass the tax amount so it doesn’t calculate the tax again, like i pass the 80 in the cost and 20 in the tax. so its shows 100 correct value in the PDF.

You can set uses_inclusive_taxes to true in the request to have the app consider the taxes as inclusive.

1 Like

I added uses_inclusive_taxes =true, its showing the tax. but not adding

requirement is like subtotal = 800
vat 20% = 200
total =1000

Sorry, that isn’t supported. If the cost is 800 and the tax is 20% then the tax amount would be 160 not 200, assuming you use exclusive taxes.

1 Like

Sorry, it’s my bad. Sorted

Glad to hear it, thanks for the update!

Hi, still I have an issue with Roundup please check this screenshot VAT amount is more than 0.1. not all the invoices. some of them have this issue.

Here my mapping

            bodyMap.put('partial',0); 
            bodyMap.put('discount',0); 
            bodyMap.put('uses_inclusive_taxes',false);
            bodyMap.put('tax_name1','VAT');
            bodyMap.put('tax_rate1',20);
            bodyMap.put('is_amount_discount',false);
            
            conMap.put('quantity',1);
            decimal cost = upPay.Amount_Paid__c/1.2;
            system.debug('cost===>'+cost);
            Decimal rounded = cost.setScale(2, RoundingMode.HALF_UP);
            system.debug(rounded);

            conMap.put('cost',string.valueof(rounded));
           
            ConList.add(conMap);
            bodyMap.put('line_items',ConList);

let me know anything you can help me out to fix this

471.43 * 1.2 = 565.716 which rounds to 565.72

Hi, I want the total amount to be 565.71. any idea?

One option may be to add a custom invoice surcharge called ‘Tax’ and manually set the amount. One drawback to this approach is that you won’t be able to use the tax reports in the app.