输入源“/body/amount/total”映射到数值 (truncated...)

发布时间:2023-05-24作者:冰貂主人点击:149

报错:

1,Client error: `POST https://api.mch.weixin.qq.com/v3/refund/domestic/refunds` resulted in a `400 Bad Request` response:
{"code":"PARAM_ERROR","detail":{"location":"body","value":0},"message":"输入源“/body/amount/total”映射到数值 (truncated...)
2,

微信支付请求失败,响应码 = 400,返回结果 = {"code":"PARAM_ERROR","detail":{"location":"body","value":{"currency":"CNY","refund":40,"total":40}},"message":"无法将 JSON 输入源“/body/amount”映射到目标字段“回退金额”中,此字段需要一个合法的 64 位无符号整数"}

请求参数 "amount":{"total":40,"currency":"CNY","refund":40}

解决:

  /body/amount/total  指的是字段,total这个键的值不对。如果是php,应该在变量前加(int)$total。让total的值是正整数。
标签: