Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting unexpected validation error "Account must be valid/Tax rate must be valid" #353

Open
cb-charchit opened this issue Nov 1, 2023 · 2 comments

Comments

@cb-charchit
Copy link

I am trying to make this request through Xero API Explorer

https://api-explorer.xero.com/accounting/invoices/createinvoices?query-unitdp=4

{
  "Invoices": [
    {
      "Type": "ACCREC",
      "Contact": {
        "ContactID": "15976e62-37ad-4065-8bba-d8c5c264e078"
      },
      "LineItems": [
        {
          "Description": "tiered-plan",
          "Quantity": 8555500,
          "UnitAmount": 0.000149611361,
          "AccountCode": "4000",
          "TaxType": "TAX001",
          "taxAmount": 256,
          "ItemCode": "cp_oct17_tiered",
          "LineAmount": 1280
        },
        {
          "Description": "stair-step",
          "Quantity": 8555500,
          "UnitAmount": 0.000029104,
          "AccountCode": "4000",
          "TaxType": "TAX001",
          "taxAmount": 49.8,
          "ItemCode": "cp_oct17_stairstep",
          "LineAmount": 249
        }
      ],
      "Date": "2023-03-11",
      "DueDate": "2022-12-10",
      "Reference": "Website Design",
      "Status": "AUTHORISED"
    }
  ]
}

Getting below validation error:

"ValidationErrors": [
        {
          "Message": "Account must be valid."
        },
        {
          "Message": "Tax rate must be valid."
        }
      ]

This is totally unexpected, as I am using same account and same tax code for other requests as well and all of them getting success.

Later I tried altering content of above request, I updated UnitAmount for second lineItem from
"UnitAmount": 0.000029104 to "UnitAmount": 0.0000291

And to my surprise, old validation error gone and now I am getting mismatch error.

New Request

{
  "Invoices": [
    {
      "Type": "ACCREC",
      "Contact": {
        "ContactID": "15976e62-37ad-4065-8bba-d8c5c264e078"
      },
      "LineItems": [
        {
          "Description": "tiered-plan",
          "Quantity": 8555500,
          "UnitAmount": 0.000149611361,
          "AccountCode": "4000",
          "TaxType": "TAX001",
          "taxAmount": 256,
          "ItemCode": "cp_oct17_tiered",
          "LineAmount": 1280
        },
        {
          "Description": "stair-step",
          "Quantity": 8555500,
          "UnitAmount": 0.0000291,
          "AccountCode": "4000",
          "TaxType": "TAX001",
          "taxAmount": 49.8,
          "ItemCode": "cp_oct17_stairstep",
          "LineAmount": 249
        }
      ],
      "Date": "2023-03-11",
      "DueDate": "2022-12-10",
      "Reference": "Website Design",
      "Status": "AUTHORISED"
    }
  ]
}

Response Error

"ValidationErrors": [
        {
          "Message": "The line total 249.00 does not match the expected line total 248.97"
        }
      ]

I would like to know what does Account must be valid / Tax rate must be valid error mean and what was the reason for this error as I am using same account and tax rate for all other requests. Was there some other internal error which is not passed in final response ?

Copy link

github-actions bot commented Nov 1, 2023

PETOSS-359

Copy link

github-actions bot commented Nov 1, 2023

Thanks for raising an issue, a ticket has been created to track your request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant