整体签名也用腾讯那个在线工具验证了,没问题。
【响应数据】:<xml><return_code><![CDATA[FAIL]]></return_code>
<return_msg><![CDATA[签名错误,请检查后再试]]></return_msg>
</xml>
报文如下(appid和商户id还有notify_url做了遮盖,其他不变。):
<xml>
<appid>wxxxxxxxxxxxxx</appid>
<mch_id>xxxxxxxxxxx</mch_id>
<nonce_str>1741310932867</nonce_str>
<sign>EC5BDCED96792EE153BF41FF7A8D2162</sign>
<body>小程序商品购买</body>
<attach><![CDATA[pay_product]]></attach>
<out_trade_no>1897606458141310976</out_trade_no>
<total_fee>100</total_fee>
<spbill_create_ip>127.0.0.1</spbill_create_ip>
<notify_url>xxxxxxxxxxxxxxxxx</notify_url>
请检查下v2密钥和接口中商户号mchid是否匹配。可以用在线的验签工具生成个签名去对比:https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=20_1
注:工具不校验密钥正确性,实际接口请求成功代表密钥正确。
这个导入进去,正确填写参数就可以调试了,https://github.com/wechatpay-apiv3/wechatpay-postman-script
先确认一下key是否正确