HOME / COMMUNITY Switch to knowledge base

Getting Error in API when have Amount or VAT Amount in decimals

When we try to save amount in decimals like 39.99 and quick file api don’t accept it so I have to do it 40.

did you change the Data Types of VAT field?

Hi @Sohaib_Ahsan,

I am not aware of anything changing but will double check for you.

Please could you give an example of the code you are using with the function / endpoint. Make sure to remove any sensitive data.

Thanks

If you are currently passing the values as numbers in the JSON try passing them as strings instead, i.e. instead of

"Amount":39.99

try

"Amount":"39.99"

Floating point numbers can’t always represent decimals exactly (the representation in computer memory is based on powers of two rather than powers of ten), and QuickFile may be seeing the 39.99 as 39.99000000000001 or something instead, and then complaining there’s too many decimal places.

I’m using XML for this . and this problems seems to be appearing from last week.

Hi @Sohaib_Ahsan

If you could provide us with an example of code and the endpoint you’re using please, we’ll take a look for you.

and last message was from quick file that VAT data type is not valid. decimal is passed in vat price .

when to pass more than 2 points in decimal then it returns this error. like 39.999 or 49.999 . and this is an error as because some times to adjust the amount we need to pass more than 2 points

Hi @Sohaib_Ahsan

All monetary fields only support up to 2 decimal places so this would be expected. If you pass 39.99 or 40.00 this should work as expected.

can i ask why it was working before and now it stopped working ?

I’ve checked with our development team and can confirm there have been some small updates to ensure data conforms to the schema. 39.999 isn’t a valid number, hence why it’s rejected.

This topic was automatically closed after 7 days. New replies are no longer allowed.