Square平台是否接受十进制金额值?新手遇报错求助
Hey there! As someone who’s navigated Square’s API quirks as a newbie too, let me break this down clearly for you.
First off: Square does NOT accept decimal values for the amount_money.amount field—that’s exactly why you’re hitting the EXPECTED_INTEGER error.
Square’s API requires all monetary amounts to be passed as integers representing the smallest unit of your currency. For example:
- If you’re charging $15.75 USD, you’d pass
1575(since 1 dollar = 100 cents) - For £20.00 GBP, you’d pass
2000(1 pound = 100 pence)
Your error message specifically calls out the amount_money.amount field expecting an integer, which means you probably sent a decimal value (like 10.99) instead of its integer equivalent (1099).
To fix this, take your intended decimal amount, multiply it by the number of subunits in your currency (usually 100 for most fiat currencies), and pass that integer instead.
Here’s a quick example of what a corrected request might look like:
{ "amount_money": { "amount": 1575, "currency": "USD" } }
That should resolve the INVALID_REQUEST_ERROR you’re seeing.
内容的提问来源于stack exchange,提问作者Atiris

