1.接口:/v3/pay/transactions/jsapi
"POST", Url, 时间戳, 随机数, 请求body数据,验签数据与本地工具生成的签名相同,
2.签名前数据:
POST\n/v3/pay/transactions/jsapi\n20240907170747563\n1155326657\n{"appid":"wx5352c9644788f117","mchid":"1527063541","description":"测试收款用的","out_trade_no":"MH20240907170747563_1","notify_url":"http://wy.gdhxgroup.com/payed.wx","amount":{"total":1,"currency":"CNY"},"payer":{"openid":"ojY3kv9jOOYP6GgtD9FPaU-h1QHg"}}\n
3.签名结果与本地工具签名相同
Authorization=WECHATPAY2-SHA256-RSA2048 mchid="1527063541",serial_no="6975CC870166CE7A274D0E2E44357AA5507B01E2",nonce_str="847600463",timestamp="20240907170428952",signature="GNGogYaMiRiwCMiipANvlOom6OW+k1hFkCtki6j5t48MmJ0q7+CHB1omcgt1e79J/EpNIcb7vcc4X0y/YKPZP6u8ePdIJ/c/l21+HrI26jw5arfK4L/2qECZ+4f44AdFachnMU3O5O5l7YS74/RThUXiEHbX1Un06WMvNKS5Qi0M25fPNm6BXMpwFszeIa6UqP9NS8qtA+NwLRxhaNrPj+RlamURg3Jjy06qCX602qtr57McCPKAPqv0jdyHGznc5kQwjsOlcpEyYEdbLfE/WspUxfJSgy83GE5ZqY+h30gzut7ymMVXls8EGoMPYqXNWMEQWN9/rw67bFVZN+YQmA=="
4.接口返回报错:
{
"code": "SIGN_ERROR",
"detail": {
"detail": {
"issue": "sign not match"
},
"field": "signature",
"location": "authorization",
"sign_information": {
"method": "POST",
"sign_message_length": 343,
"truncated_sign_message": "POST\n/v3/pay/transactions/jsapi\n20240907170428952\n847600463\n{\"appid\"\n",
"url": "/v3/pay/transactions/jsapi"
}
},
"message": "签名错误,请检查后再试"
}
还请参考https://pay.weixin.qq.com/docs/merchant/development/interface-rules/signature-faqs.html