I'm having issues accepting payment through my ecommerce site. This only seems to happen randomly, I've accepted payment previous without issue but every so often this happens. Square API didn't have any description with the error code.
Array
(
[0] => stdClass Object
(
[category] => INVALID_REQUEST_ERROR
[code] => EXPECTED_INTEGER
[detail] => Expected an integer value.
[field] => amount_money.amount
)
)
Order status changed from Pending payment to Failed.
This error occurs whenever you try to charge with an amount that is not an integer value, such as a decimal or a floating point number. One thing you can do to prevent this is to check and make sure the type of amount you're charging is a whole number.
Additionally, thank you for the feedback about Square's Developer Doc. We are constantly improving the product based on feedback like this, so I’ll be sure to share your thoughts with the appropriate team.
I had a similar problem. The numbers that were being passed by my input field were being read as strings instead of integers. Even though the output in the front end console read like an integer, I noticed on the backend the numbers coming back form req.body had quotes around them. The fix was to use parseInt to strip the quotes away. My code is based on Node/Express on the backend and Handlebars on the frontend. I hope this example helps: