invoice tax is incorrect

  • 1
  • Question
  • Updated 1 year ago
  • Answered
Hi Team,

I am trying to create an invoice in Reckon from a woocommerce purchase, and am constantly being told that the "Invoice tax is incorrect"

I am sending the following JSON to the endpoint:
{"CustomerID":"30b44591-e302-4718-901a-21c249085280","AmountTaxStatus":2,"Reference":"Order 2714","InvoiceAmount":15.9500,"InvoiceTax":1.45,"PurchaseDescription":"Purchase through madameflavourshop.com","InvoiceDate":"2017-11-23","DueDate":"2017-11-30","LineItems":[{"Amount":"5.9500","ChargeableItemId":"613b9d56-0fd5-41b1-b03d-7a0a45b9b950","LineNo":1,"Description":"Mint Lavender","Quantity":1},{"Amount":"10.0000","ChargeableItemId":"613b9d56-0fd5-41b1-b03d-7a0a45b9b950","LineNo":2,"Description":"Shipping","Quantity":1,"UnitPriceIsTaxInclusive":false}],"TemplateID":"4f5aeeb7-1f56-496d-a02f-aacf5ae76552"}

This is a tax-inclusive invoice for $15.95, which would include a component of  $1.45 GST, as per the amounts in InvoiceAmount and InvoiceTax fields.

Could someone please tell me what I'm doing wrong here?

If enter amounts against the line items individually, I also get a "Tax for line 1 is incorrect." message
{"CustomerID":"30b44591-e302-4718-901a-21c249085280","AmountTaxStatus":2,"Reference":"Order 2715","InvoiceAmount":"15.9500","InvoiceTax":"1.4500","PurchaseDescription":"Purchase through madameflavourshop.com","InvoiceDate":"2017-11-23","DueDate":"2017-11-30","LineItems":[{"Amount":"5.9500","ChargeableItemId":"613b9d56-0fd5-41b1-b03d-7a0a45b9b950","LineNo":1,"Description":"Mint Lavender","Quantity":1,"UnitPriceExTax":"5.4091","UnitPriceTax":"0.5409","UnitPriceIsTaxIncludive":true,"TaxAmount":"0.5409","AmountExTax":"5.4091"},{"Amount":"10.0000","ChargeableItemId":"613b9d56-0fd5-41b1-b03d-7a0a45b9b950","LineNo":2,"Description":"Shipping","Quantity":1,"UnitPriceExTax":"5.4091","UnitPriceTax":"0.5409","UnitPriceIsTaxIncludive":true,"TaxAmount":"0.5409","AmountExTax":"5.4091"}],"TemplateID":"4f5aeeb7-1f56-496d-a02f-aacf5ae76552"}
Photo of Lucas Williams

Lucas Williams

  • 280 Points 250 badge 2x thumb

Posted 1 year ago

  • 1
Photo of Jason Hollis

Jason Hollis, Head of Product

  • 9,614 Points 5k badge 2x thumb
Hi Lucas,

With the SDK you must always send the NET amount + tax. 

The IsTaxIncluded tag is just to determine how the transaction shows in the UI. ie Show as gross or net.

** I also noted a typo in your code: UnitPriceIsTaxIncludive
Photo of Linda Putland

Linda Putland, Accredited Partner

  • 6,632 Points 5k badge 2x thumb
Lucas - I can see a few issues - with the top one - I think you have unit price tax inclusive set to false but with the prices being $5.95 and $10 shouldnt it be set to true? 
with the 2nd example - the 2nd line for shipping has the pricing of the first line instead of the pricing for the shipping? there is also a typo for the first line where inclusive is spelt includive? could be your issues?
Photo of Lucas Williams

Lucas Williams

  • 280 Points 250 badge 2x thumb
Hi,

I have fixed up the TaxIncludive typo and the issue with the shipping amounts as per the suggestions here and now get a "Tax exclusive amount for line 1 is incorrect" message with the following data:

{"CustomerID":"30b44591-e302-4718-901a-21c249085280","AmountTaxStatus":2,"Reference":"Order 2721","InvoiceAmount":"15.95","InvoiceTax":"1.45","PurchaseDescription":"Purchase through madameflavourshop.com","InvoiceDate":"2017-11-23","DueDate":"2017-11-30","LineItems":[{"Amount":"5.95","ChargeableItemId":"613b9d56-0fd5-41b1-b03d-7a0a45b9b950","LineNo":1,"Description":"Mint Lavender","Quantity":1,"UnitPriceExTax":"5.41","UnitPriceTax":"0.54","UnitPriceIsTaxInclusive":true},{"Amount":"10.00","ChargeableItemId":"613b9d56-0fd5-41b1-b03d-7a0a45b9b950","LineNo":2,"Description":"Shipping","Quantity":1,"UnitPriceExTax":"9.09","UnitPriceTax":"0.91","UnitPriceIsTaxInclusive":true}],"TemplateID":"4f5aeeb7-1f56-496d-a02f-aacf5ae76552"}

Item 1 has an amount of $5.95, ExTax of $5.41 and Tax of $0.54 (which add up to $5.95). 
Item 2 has an amount of $10.00, ExTax of $9.09 and Tax of $0.91 (which add up to $10.00).

Both have their UnitPriceIsTaxInclusive set to true, as the amount is the sum.
Photo of Linda Putland

Linda Putland, Accredited Partner

  • 6,632 Points 5k badge 2x thumb
So I am not an expert with the SDK but have experience with importing to Reckon... you have now made all the line item unit pricing exclusive - so I think you should have left the UnitPriceisTaxInclusive set to False?  you have changed it to true - but also changed the pricing?  I am thinking this is the problem?
Photo of Lucas Williams

Lucas Williams

  • 280 Points 250 badge 2x thumb
Even when I change the UnitPriceIsTaxInclusive to false, I get a "Tax exclusive amount for line 1 is incorrect", this also happens if I expand to 4 decimal places in the amounts:

{
    "CustomerID": "30b44591-e302-4718-901a-21c249085280",
    "AmountTaxStatus": 2,
    "Reference": "Order 2730",
    "InvoiceAmount": "21.45",
    "InvoiceTax": "1.95",
    "PurchaseDescription": "Purchase through madameflavourshop.com",
    "InvoiceDate": "2017-11-23",
    "DueDate": "2017-11-30",
    "LineItems": [{
        "Amount": "5.95",
        "ChargeableItemId": "613b9d56-0fd5-41b1-b03d-7a0a45b9b950",
        "LineNo": 1,
        "Description": "Mint Lavender",
        "Quantity": 1,
        "UnitPriceExTax": "5.41",
        "UnitPriceTax": "0.54",
        "UnitPriceIsTaxInclusive": false
    }, {
        "Amount": "5.50",
        "ChargeableItemId": "613b9d56-0fd5-41b1-b03d-7a0a45b9b950",
        "LineNo": 2,
        "Description": "A product",
        "Quantity": 1,
        "UnitPriceExTax": "5.00",
        "UnitPriceTax": "0.50",
        "UnitPriceIsTaxInclusive": false
    }, {
        "Amount": "10.00",
        "ChargeableItemId": "613b9d56-0fd5-41b1-b03d-7a0a45b9b950",
        "LineNo": 3,
        "Description": "Shipping",
        "Quantity": 1,
        "UnitPriceExTax": "9.09",
        "UnitPriceTax": "0.91",
        "UnitPriceIsTaxInclusive": false
    }],
    "TemplateID": "4f5aeeb7-1f56-496d-a02f-aacf5ae76552"
}
Photo of Linda Putland

Linda Putland, Accredited Partner

  • 6,632 Points 5k badge 2x thumb
hmm.. this is a bit beyond me - might require tech support/API support help?  it seems strange that you arent required to put the tax code in?  I wonder if that has something to do with it?
Photo of Ifti

Ifti, Product Manager

  • 6,236 Points 5k badge 2x thumb
Hi Lucas,

Can you please also include the Tax code's ID by adding TaxGroupId? That might be causing this issue.

Please have a look at this below sample post.

{'CustomerId':'9b4b615f-2815-4f9c-a765-d7f8517cea6a','AmountTaxStatus':2,'InvoiceAmount':2.0000,'InvoiceDiscountAmount':null,'InvoiceDiscountPercentage':null,'InvoiceTax':0.1800,'Notes':null,'PaymentDetails':null,'Reference':null,'TemplateId':'3edc5b6f-37aa-4516-8c1e-3cf268bf51e6','InvoiceDate':'2016-03-07T00:00:00','SendDate':null,'DueDate':null,'Address':null,'TaxSummaryText':null,'LineItems':[{'ParentInvoiceLineItemId':null,'BillableId':null,'DiscountAmountExTax':null,'DiscountAmountTax':null,'DiscountPercent':null,'Amount':2.00,'InvoiceDiscountedAmountExTax':1.8200,'InvoiceDiscountedTaxAmount':0.1800,'HasDataForPosting':true,'IsSubTotal':false,'IsParent':false,'IsHidden':false,'AccountId':'00000000-0000-0000-0000-000000000000','PrintGroupAsSingleLine':false,'ChargeableItemId':'8cd53f00-f6b9-4d6c-891d-83cc6a348e40','LineNo':1,'Description':'SD','Quantity':null,'UnitPriceExTax':1.8181818182,'UnitPriceTax':0.1818181818,'UnitPriceIsTaxInclusive':false,'TaxGroupId':'e6015088-28f5-4bfe-8085-ff9fc2564efa','TaxIsModified':false,'TaxAmount':0.1800,'AmountExTax':1.8182}]}

Thanks

Ifti
Photo of Ifti

Ifti, Product Manager

  • 6,236 Points 5k badge 2x thumb
You can find sample codes via this link.
Photo of Lucas Williams

Lucas Williams

  • 280 Points 250 badge 2x thumb
Hi Ifti,

I am trying to put the TaxGroupID in, but when I attempt to access the endpoint for TaxGroups, I receive a 404 error - I am making the following request, so I can get the correct ID from my book:

GET https://api.reckon.com/R1/<book_id>/taxgroups HTTP/1.1
Host: api.reckon.com
Accept: */*
Authorization: Bearer <encoded token>
Photo of Shane

Shane, Employee

  • 7,388 Points 5k badge 2x thumb
Hi Lucus,

You are leaving out the effective date.

https://api.reckon.com/R1/{cashbookId}/taxgroups/{effectiveDate}

You need that to get the tax groups.
Photo of Lucas Williams

Lucas Williams

  • 280 Points 250 badge 2x thumb
Thanks Shane; the documenation I was using (https://reckon.helpdocsonline.com/api-reckon-one-endpoints$endpoint_taxGroups) did not mention this.

I am now being told my tax amount is incorrect, yet when I do the maths myself, it all works out correctly.

{"CustomerID":"30b44591-e302-4718-901a-21c249085280","AmountTaxStatus":2,"Reference":"Order 2666","InvoiceAmount":"62.50","InvoiceTax":"5.68","PurchaseDescription":"Purchase through madameflavourshop.com","InvoiceDate":"2017-11-26","DueDate":"2017-12-03","LineItems":[{"Amount":"52.50","ChargeableItemId":"613b9d56-0fd5-41b1-b03d-7a0a45b9b950","LineNo":1,"Description":"Afternoon in Paris","Quantity":1,"UnitPriceExTax":"47.73","UnitPriceTax":"4.77","UnitPriceIsTaxInclusive":false,"TaxAmount":"4.77","AmountExTax":"47.73"},{"Amount":"10.00","ChargeableItemId":"613b9d56-0fd5-41b1-b03d-7a0a45b9b950","LineNo":2,"Description":"Shipping","Quantity":1,"UnitPriceExTax":"9.09","UnitPriceTax":"0.91","UnitPriceIsTaxInclusive":false,"TaxAmount":"0.91","AmountExTax":"9.09","TaxIsModified":true,"DiscountAmountExTax":null,"DiscountAmountTax":null,"DiscountPercent":null,"InvoiceDiscountedTaxAmount":"0.91","InvoiceDiscountedAmountExTax":"9.09"}],"TemplateID":"4f5aeeb7-1f56-496d-a02f-aacf5ae76552","TaxGroupId":"450bee25-e440-478a-9a0d-33b73df663fd"}
Do I have to send every property when making an invoice?  That does seem like overkill
Photo of Ifti

Ifti, Product Manager

  • 6,236 Points 5k badge 2x thumb
Hi Lucas,

For the Tax amount, please send the NET amount (AmountTaxStatus: 3) and the appropriate Tax Code.Let Reckon One do the Tax calculation for you. We're working on making this tax calculation work even more efficiently via API.

Sample Post:

 {'CustomerId':'9b4b615f-2815-4f9c-a765-d7f8517cea6a','AmountTaxStatus':2,'InvoiceAmount':2.0000,'InvoiceDiscountAmount':null,'InvoiceDiscountPercentage':null,'InvoiceTax':0.1800,'Notes':null,'PaymentDetails':null,'Reference':null,'TemplateId':'3edc5b6f-37aa-4516-8c1e-3cf268bf51e6','InvoiceDate':'2016-03-07T00:00:00','SendDate':null,'DueDate':null,'Address':null,'TaxSummaryText':null,'LineItems':[{'ParentInvoiceLineItemId':null,'BillableId':null,'DiscountAmountExTax':null,'DiscountAmountTax':null,'DiscountPercent':null,'Amount':2.00,'InvoiceDiscountedAmountExTax':1.8200,'InvoiceDiscountedTaxAmount':0.1800,'HasDataForPosting':true,'IsSubTotal':false,'IsParent':false,'IsHidden':false,'AccountId':'00000000-0000-0000-0000-000000000000','PrintGroupAsSingleLine':false,'ChargeableItemId':'8cd53f00-f6b9-4d6c-891d-83cc6a348e40','LineNo':1,'Description':'SD','Quantity':null,'UnitPriceExTax':1.8181818182,'UnitPriceTax':0.1818181818,'UnitPriceIsTaxInclusive':false,'TaxGroupId':'e6015088-28f5-4bfe-8085-ff9fc2564efa','TaxIsModified':false,'TaxAmount':0.1800,'AmountExTax':1.8182}]}

Create a Tax Invoice via UI with the same amount and then retrieve that invoice via API, you will then see how different fields are filled up. That will help you understand the requirements more.

Thanks

Ifti
Photo of Lucas Williams

Lucas Williams

  • 280 Points 250 badge 2x thumb
Hi Ifti,

Thanks, I have simplified my call a lot but now get "invoice tax is incorrect" again:

{
 "CustomerID":"30b44591-e302-4718-901a-21c249085280",
 "AmountTaxStatus":3,
 "Reference":"Order 2671",
 "InvoiceAmount":"15.3636",
 "InvoiceTax":"1.5364",
 "PurchaseDescription":"Purchase through madameflavourshop.com",
 "InvoiceDate":"2017-11-27",
 "DueDate":"2017-12-04",
 "TemplateID":"4f5aeeb7-1f56-496d-a02f-aacf5ae76552",
 "TaxGroupId":"450bee25-e440-478a-9a0d-33b73df663fd",
 "LineItems":[  {
   "Amount":"6.90",
   "ChargeableItemId":"613b9d56-0fd5-41b1-b03d-7a0a45b9b950",
   "LineNo":1,
   "Description":"Australian Morning",
   "Quantity":1,
   "UnitPriceIsTaxInclusive":true
  },
  {
   "Amount":"10.00",
   "ChargeableItemId":"613b9d56-0fd5-41b1-b03d-7a0a45b9b950",
   "LineNo":2,
   "Description":"Shipping",
   "Quantity":1,
   "UnitPriceIsTaxInclusive":true
  }]
}
Adding 15.3636 to 1.5364, I get 16.90 (the total).  The examples provide 2, 4, and 8 point decimal precision on different properties - which of these is correct?

What amounts should I be providing for my invoice amount and invoice tax to have this invoice process successfully?
Photo of Linda Putland

Linda Putland, Accredited Partner

  • 6,632 Points 5k badge 2x thumb
ok - so what you have put for the tax - doesnt work because you have 2 line items and each line calculates its own tax...  and the sum of that tax doesnt work out to 1.5364...

For line 1 - if you use 2 decimal places the tax is .63 and then line 2 tax is .91 - this makes the total tax 1.54 and the invoice amount becomes 15.36 - have you tried it with these numbers? using the 4 decimal places would still mean some rounding - I would try 2 decimal places first... but remember that Reckon will calculate GST on each line....
Photo of Lucas Williams

Lucas Williams

  • 280 Points 250 badge 2x thumb
Hi Linda,

Thanks for the suggestion; when I put all numbers as 2 decimal places, and only pass the line item amount (no tax, no ex gst, etc.) for the items, I still get a n "Invoice tax is incorrect message on the total of the invoice, using 15.36 and 1.54

If I take tax completely out of the equation here, with 2 items (6.90 and 10.00) I get an Invoice amount is incorrect message when telling Reckon the invoice has a tax type of "non-taxed"

I can take this further and remove the Invoice Amount and Invoice Tax from the invoice, and then get told that the Discounted Tax Exclusive Amount for line item 1 is incorrect.  I'm not sure why I would even need to provide a discounted Tax Exclusive Amount for items when there isn't a discount being applied.

For the sake of simplicity, I have changed some product prices in my sample data to get nice round numbers that divide by 11, my taxbook having a rate of "10".  My latest data is as such:

{
    "CustomerID": "30b44591-e302-4718-901a-21c249085280",
    "AmountTaxStatus": 2,
    "Reference": "Order 2674",
    "PurchaseDescription": "Purchase through madameflavourshop.com",
    "InvoiceDate": "2017-11-27",
    "InvoiceAmount":17.6,
    "InvoiceTax":1.6,
    "DueDate": "2017-12-04",
    "LineItems": [{
        "UnitPriceExTax": 6.00,
        "UnitPriceTax":0.60,
        "ChargeableItemId": "613b9d56-0fd5-41b1-b03d-7a0a45b9b950",
        "LineNo": 1,
        "Description": "Australian Morning",
        "Quantity": 1,
        "UnitPriceIsTaxInclusive": false,
        "TaxIsModified":true
    }, {
        "UnitPriceExTax": 10.00,
        "UnitPriceTax":1.00,
        "ChargeableItemId": "613b9d56-0fd5-41b1-b03d-7a0a45b9b950",
        "LineNo": 2,
        "Description": "Shipping",
        "Quantity": 1,
        "UnitPriceIsTaxInclusive": false,
        "TaxIsModified":true
    }],
    "TemplateID": "4f5aeeb7-1f56-496d-a02f-aacf5ae76552",
    "TaxGroupId": "450bee25-e440-478a-9a0d-33b73df663fd"
}

I am still being told that my invoice tax is incorrect, and cannot ignore this property to have the system generate the tax total for me.  It does not matter if I change the Tax Status to 3 (Exclusive) and Amount to $16.00, I get the same message.  
If I remove the "TaxIsModified" from each line, I get a "Tax exclusive amount for line 1 is incorrect" instead.
Photo of Simon Hutchinson

Simon Hutchinson, Employee

  • 2,462 Points 2k badge 2x thumb
Hi Lucas,

Please find below a successful request to the API with the required fields, note that some of the fields we have updated because our book has different ID's etc but this will help you get the structure correct

{
  "AmountTaxStatus": 2,
  "CustomerID": "3ae59239-300d-4504-882e-b52ef9b9079d",
  "DueDate": "2017-12-04",
  "InvoiceAmount": 17.6,
  "InvoiceDate": "2017-11-27",
  "InvoiceTax": 1.60,
  "LineItems": [
    {
      "Amount": 6.60,
      "AmountExTax": 6.00,
      "ChargeableItemId": "67bfa476-fa04-450f-ad72-532a3cb6fb24",
      "Description": "Australian Morning",
      "InvoiceDiscountedAmountExTax": 6.00,
      "LineNo": 1,
      "Quantity": 1,
      "TaxIsModified": true,
      "TaxAmount": 0.60,
      "UnitPriceExTax": 6.00,
      "UnitPriceIsTaxInclusive": false,
      "UnitPriceTax": 0.60,
      "HasDataForPosting": true,
      "TaxIsModified": true
    },
    {
      "Amount": 11.00,
      "AmountExTax": 10.00,
      "ChargeableItemId": "67bfa476-fa04-450f-ad72-532a3cb6fb24",
      "Description": "Shipping",
      "InvoiceDiscountedAmountExTax": 10.00,
      "LineNo": 2,
      "Quantity": 1,
      "TaxIsModified": true,
      "TaxAmount": 1.00,
      "UnitPriceExTax": 10.00,
      "UnitPriceIsTaxInclusive": false,
      "UnitPriceTax": 1.00,
      "HasDataForPosting": true,
      "TaxIsModified": true
    }
  ],
  "PurchaseDescription": "Purchase through madameflavourshop.com",
  "Reference": "Order 2674",
  "TaxGroupId": "1cf67f48-850d-42c6-b774-454cc7defa7f",
  "TemplateID": "b0951418-5bce-4e1a-924e-b4fe6379f001"
}


Cheers.
Photo of Lucas Williams

Lucas Williams

  • 280 Points 250 badge 2x thumb
Hi Simon,

Great; I can now create an invoice using nice, round, amounts for the purpose of demonstration.  I still have the issue where my "strange" amounts provide me with a "Discounted tax exclusive amount for line item 1 is incorrect" message with the following body (using IDs from my Reckon instance)

{
    "AmountTaxStatus": 2,
    "CustomerID": "30b44591-e302-4718-901a-21c249085280",
    "DueDate": "2017-12-04",
    "InvoiceAmount": "15.95",
    "InvoiceDate": "2017-11-27",
    "InvoiceTax": "1.45",
    "LineItems": [{
        "Amount": "5.95",
        "AmountExTax": "5.41",
        "ChargeableItemId": "613b9d56-0fd5-41b1-b03d-7a0a45b9b950",
        "Description": "Mint Lavender",
        "InvoiceAmountDiscountedExTax": "5.41",
        "LineNo": 1,
        "Quantity": 1,
        "TaxIsModified": true,
        "TaxAmount": "0.54",
        "UnitPriceExTax": "5.41",
        "UnitPriceIsTaxInclusive": false,
        "UnitPriceTax": "0.54",
        "HasDataForPosting": true
    }, {
        "Amount": "10.00",
        "AmountExTax": "9.09",
        "ChargeableItemId": "d0174dbb-fe0b-4b53-9155-4922030ffbaa",
        "Description": "Mint Lavender",
        "InvoiceAmountDiscountedExTax": "9.09",
        "LineNo": 2,
        "Quantity": 1,
        "TaxIsModified": true,
        "TaxAmount": "0.91",
        "UnitPriceExTax": "9.09",
        "UnitPriceIsTaxInclusive": false,
        "UnitPriceTax": "0.91",
        "HasDataForPosting": true
    }],
    "PurchaseDescription": "Purchase through madameflavourshop.com",
    "Reference": "Order 2741",
    "TaxGroupId": "450bee25-e440-478a-9a0d-33b73df663fd",
    "TemplateID": "4f5aeeb7-1f56-496d-a02f-aacf5ae76552"
}

What am I missing here?  Is there not enough decimal precision in my amounts, perhaps?
Photo of Simon Hutchinson

Simon Hutchinson, Employee

  • 2,462 Points 2k badge 2x thumb
Hi Lucas,

can you try this payload

{
    "AmountTaxStatus": 2,
    "CustomerID": "30b44591-e302-4718-901a-21c249085280",
    "DueDate": "2017-12-04",
    "InvoiceAmount": "15.95",
    "InvoiceDate": "2017-11-27",
    "InvoiceTax": "1.45",
    "LineItems": [{
        "Amount": "5.95",
        "AmountExTax": "5.41",
        "ChargeableItemId": "613b9d56-0fd5-41b1-b03d-7a0a45b9b950",
        "Description": "Mint Lavender",
        "InvoiceAmountDiscountedExTax": "5.41",
        "InvoiceAmountDiscountedTaxAmount": 0.54,
        "LineNo": 1,
        "Quantity": 1,
        "TaxIsModified": true,
        "TaxAmount": "0.54",
        "UnitPriceExTax": "5.41",
        "UnitPriceIsTaxInclusive": false,
        "UnitPriceTax": "0.54",
        "HasDataForPosting": true
    }, {
        "Amount": "10.00",
        "AmountExTax": "9.09",
        "ChargeableItemId": "d0174dbb-fe0b-4b53-9155-4922030ffbaa",
        "Description": "Mint Lavender",
        "InvoiceAmountDiscountedExTax": "9.09",
        "InvoiceAmountDiscountedTaxAmount": "0.91",
        "LineNo": 2,
        "Quantity": 1,
        "TaxIsModified": true,
        "TaxAmount": "0.91",
        "UnitPriceExTax": "9.09",
        "UnitPriceIsTaxInclusive": false,
        "UnitPriceTax": "0.91",
        "HasDataForPosting": true
    }],
    "PurchaseDescription": "Purchase through madameflavourshop.com",
    "Reference": "Order 2741",
    "TaxGroupId": "450bee25-e440-478a-9a0d-33b73df663fd",
    "TemplateID": "4f5aeeb7-1f56-496d-a02f-aacf5ae76552"
}

The issue is related to not including these elements

"InvoiceDiscountedAmountExTax":
"InvoiceDiscountedTaxAmount":

On each entry in the Line Items array. Even though you are not providing a discount, the system still needs to know what the amount is when a discount is applied, so you just set those two elements to the same amount as AmountExTax and TaxAmount. Unless you are applying a discount in which case you need to set the amounts after discount here.

Hope that helps

Cheers.
Photo of Lucas Williams

Lucas Williams

  • 280 Points 250 badge 2x thumb
Hi Simon,

Thanks for the explanation, but I'm still getting the "Discounted tax exclusive amount for line item 1 is incorrect." using your payload (with the &nbsp; taken out)

Do I need to include "DiscountAmountExTaxAmount" and/or "DiscountPercent" set to 0?

As an aside, should I be setting a TaxGroup on the Invoice, the Items, or both?
Photo of Simon Hutchinson

Simon Hutchinson, Employee

  • 2,462 Points 2k badge 2x thumb
Hi Lucas,

The tax group should be set on the line items because you may have a different tax code per line.

As for the other problem i am looking at it for you now. You should not need to include those two items that you have listed.
Photo of Simon Hutchinson

Simon Hutchinson, Employee

  • 2,462 Points 2k badge 2x thumb
Hi Lucas,

Please try this payload (again ID's edited for my own book so please update)

{
  "AmountTaxStatus": 2,
  "CustomerID": "3ae59239-300d-4504-882e-b52ef9b9079d",
  "DueDate": "2017-12-04",
  "InvoiceAmount": 15.95,
  "InvoiceDate": "2017-11-27",
  "InvoiceTax": 1.45,
  "LineItems": [
    {
      "Amount": 5.95,
      "AmountExTax": 5.41,
      "ChargeableItemId": "67bfa476-fa04-450f-ad72-532a3cb6fb24",
      "Description": "Australian Morning",
      "InvoiceDiscountedAmountExTax": 5.41,
      "LineNo": 1,
      "Quantity": 1,
      "TaxIsModified": true,
      "TaxAmount": 0.54,
      "UnitPriceExTax": 5.41,
      "UnitPriceIsTaxInclusive": false,
      "UnitPriceTax": 0.54,
      "HasDataForPosting": true,
      "TaxIsModified": true
    },
    {
      "Amount": 10.00,
      "AmountExTax": 9.09,
      "ChargeableItemId": "67bfa476-fa04-450f-ad72-532a3cb6fb24",
      "Description": "Shipping",
      "InvoiceDiscountedAmountExTax": 9.09,
      "LineNo": 2,
      "Quantity": 1,
      "TaxIsModified": true,
      "TaxAmount": 0.91,
      "UnitPriceExTax": 9.09,
      "UnitPriceIsTaxInclusive": false,
      "UnitPriceTax": 0.91,
      "HasDataForPosting": true,
      "TaxIsModified": true
    }
  ],
  "PurchaseDescription": "Purchase through madameflavourshop.com",
  "Reference": "Order 2674",
  "TaxGroupId": "1cf67f48-850d-42c6-b774-454cc7defa7f",
  "TemplateID": "b0951418-5bce-4e1a-924e-b4fe6379f001"
}
Photo of Lucas Williams

Lucas Williams

  • 280 Points 250 badge 2x thumb
Hi Simon,

Thanks, I have managed to create an invoice successfully now.

I had a typo in the InvoiceDiscountedAmountExTax property, where I was calling it InvoiceAmountDiscountedAmountExTax, meaning that the required property was not being saved.

Thank you for persisting with this and helping me to get the right values in through the API, it looks correct to me.

Now on to processing a payment for these invoices!


Cheers,
Lucas
Photo of Linda Putland

Linda Putland, Accredited Partner

  • 6,632 Points 5k badge 2x thumb
Yeh! glad you got it working!  :)