【发布时间】:2016-09-19 10:52:04
【问题描述】:
我正在尝试向 Square 中的 /locations/{location}/transactions 端点传递 POST 请求以向卡收费。我有一个随机数、一个位置 ID 和一个 Guid(.NET 实现)。一切正常,除了我不能传递一个十进制值。我正在使用沙盒。
当我通过以下,API返回422,Value was not expected to be a string
{
"card_nonce":"VALID_CARD_NONCE",
"amount_money":{
"amount":"225.00",
"currency":"USD"
},
"idempotency_key":"3f5f21a5-9d6b-4277-93b2-2b257a8e64df"
}
当我通过以下内容时,API 返回 422,Value was not expected to be a number 225.00
{
"card_nonce":"VALID_CARD_NONCE",
"amount_money":{
"amount": 225.00,
"currency":"USD"
},
"idempotency_key":"3f5f21a5-9d6b-4277-93b2-2b257a8e64df"
}
当我通过以下内容时,API 返回 200
{
"card_nonce":"VALID_CARD_NONCE",
"amount_money":{
"amount": 225,
"currency":"USD"
},
"idempotency_key":"3f5f21a5-9d6b-4277-93b2-2b257a8e64df"
}
它允许我提交整数,但不能提交小数。任何想法为什么?
【问题讨论】:
标签: square-connect