HOME / COMMUNITY Switch to knowledge base

API: Invoice_Create - Negative Line Items


I’ve noticed an issue with negative line items when the VAT amounts are slightly dodgy (e.g. £2.25 can’t easily by split because £1.87+20%VAT = £2.24 and £1.88+20%VAT = £2.26):

                        "ItemID": 0,
                        "ItemName": "",
                        "ItemDescription": "Shipping Promotion",
                        "Tax1": {
                            "TaxName": "VAT",
                            "TaxPercentage": 20.0,
                            "TaxAmount": -0.38
                        "UnitCost": -1.87,
                        "Qty": 1

After upload this became -£1.87 with VAT of -£0.37. The positive version of this worked as expected (£1.87 with £0.38 VAT).

Any suggestions?

Hi @HS_Ltd

Are you specifying the TaxAmount as shown in your example, or is that the return data?

Yep, it’s specified in the submission. Do you want me to PM you the submission details?

Certainly - please do, and we can take a look :slight_smile:

I’ve noticed this sort of thing in one or two other places in the past, QuickFile seems happy to let you set a VAT amount less than the calculated percentage but not more, or at least it allowed a wider margin one side than the other. Which is usually fine in positive numbers but the logic is wrong in negatives - to be consistent it should allow VAT amounts closer to zero than the calculated percentage, rather than less than (which means further from zero when dealing with negative amounts).

It seems to allow VAT amounts greater than the calculated percentage. It’s happy with £1.87 + £0.38 (when it should be £0.374), but not with the negative equivalent.

I think you might be right about the source of the error being “greater than” when it should be “greater than absolute value”. It’s been passed to the developers. Can wait and see what they come back with :slight_smile:

@HS_Ltd would you mind retrying? We identified a specific issue in the API logic around negative line items.

@ian_roberts for sales and purchase invoices we allow for a 10p margin above the calculated VAT amount. So a £10 net item with 20% vat would allow a VAT amount of 2.10 but no more. On the other side you could go down to 1p.

The VAT percentages on invoices are more for reference purposes, rather than forming any basis in the calculations. It’s the monetary VAT amount recorded that is used for all VAT reporting purposes.

And what are the rules for credit notes? Are they exactly the same (allow any amount less than 20% or up to 10p more - which is wrong for negative numbers) or the mirror image (allow any amount between 20%-10p and zero)?

It should be the reverse logic, i.e. for 20% VAT on - £10 it should allow up to - £2.10 VAT, or as little as -£0.01. Not tested that, but it’s what I would expect to see.