klover2/wechatpay-node-v3-ts

错误的签名,验签失败?

hexlul opened this issue · 6 comments

微信提现到零钱,使用pay.batches_transfer可正常支付,但是使用
// 商家批次单号查询批次单API
const res = await pay.query_batches_transfer_list()
// 商家明细单号查询明细单API
const res = await pay.query_batches_transfer_detail()
都会提示错误的签名,验签失败?

error:
code: "SIGN_ERROR"
detail:
detail: {issue: "sign not match"}
field: "signature"
location: "authorization"
sign_information:
method: "GET"
sign_message_length: 203
truncated_sign_message: "GET↵/v3/transfer/batches/out-batch-no/KYFK2022100710150041/details/out-detail-no/KYFK20221007101500410001?out_batch_no=KYFK2022100710150041&out_detail_no=KYFK20221007101500410001↵1665220987↵fwgttrbx0ym↵↵"
url: "/v3/transfer/batches/out-batch-no/KYFK2022100710150041/details/out-detail-no/KYFK20221007101500410001?out_batch_no=KYFK2022100710150041&out_detail_no=KYFK20221007101500410001"
[[Prototype]]: Object
[[Prototype]]: Object
message: "错误的签名,验签失败"``

https://api.mch.weixin.qq.com/v3/transfer/batches/out-batch-no/x23zy545Bd5436/details/out-detail-no/plfk2020042013 官方文档中并没有要求参数需在URL传参,是这个原因吗?

你可以参考首页这个自己控制请求参数试试
image

我觉得应该是我参数的顺序弄错了

image

https://api.mch.weixin.qq.com/v3/transfer/batches/out-batch-no/x23zy545Bd5436/details/out-detail-no/plfk2020042013 官方文档中并没有要求参数需在URL传参,是这个原因吗?

或者使用最新版本npm 2.0.3

感谢大佬!问题已解决!