生成签名用的数据:
POST
/v3/pay/partner/transactions/jsapi
1743768110
fl2GuaHAafnUCkaoXfUoBfWiAIpwOMhk
{"out_trade_no":"20250404550101676642304","description":"白色测试商品","sub_mchid":"1898****865","amount":{"total":100},"payer":{"sp_openid":"ooDnw61oUZXjzAm6S-Fgy3lo1M1k"},"settle_info":{"profit_sharing":true},"notify_url":"http:\/\/127.0.0.1:8000\/api\/pay\/notify\/100001\/weapp\/merchantpay\/pay","sp_appid":"wx02616f0c****37ca","sp_mchid":"1685****917"}
生成的header Authorization:
WECHATPAY2-SHA256-RSA2048 mchid="1685****917",nonce_str="fl2GuaHAafnUCkaoXfUoBfWiAIpwOMhk",timestamp="1743768110",serial_no="1812A9AC856E06F15FF98FFD4917F01962528997",signature="RceQoTq8wzC6vhDA91K6muUUPpTiaN6MXaqWl8/NlCari54jlijC4p2Ar2uitd7PxfY4490zvEp4wVub1HigwRhC5Wuw+v2A8fnQVGZ9BiYZiJ2ODqyxHyl7Z2530xOlx7ywvPWibRreN9h12r7zTyWGKjemQcNmuRp8vSnbwROnDp10+6wGgYi4C2bmAADBDMn2gscV78eDQT2OxDW8iZm8nOi5Pn41Vvw2QlTxv4A07t1v5SymqELaHuX/f8lRpIUvSke1p8VlZQslmBe32XVgLUdKo1A+rLG4SrR69C3j0gfTAbnEMjhFNRPTrJKuatNz2z8B40hdLEqUKUUcLw=="
返回信息:
"code":"SIGN_ERROR","message":"签名错误"}
Request-Id:08AE94BFBF0610D30718F6DB8C5820B3B70E28DFA703-268443699
全部返回数据:
{
"rocket": {
"Yansongda\\Artful\\Rocket": {
"radar": {
"url": "https://api.mch.weixin.qq.com/v3/pay/partner/transactions/jsapi",
"method": "POST",
"headers": {
"Host": [
"api.mch.weixin.qq.com"
],
"Accept": [
"application/json, text/plain, application/x-gzip"
],
"User-Agent": [
"yansongda/pay-v3"
],
"Content-Type": [
"application/json; charset=utf-8"
],
"Authorization": [
"WECHATPAY2-SHA256-RSA2048 mchid=\"1685****917\",nonce_str=\"fl2GuaHAafnUCkaoXfUoBfWiAIpwOMhk\",timestamp=\"1743768110\",serial_no=\"1812A9AC856E06F15FF98FFD4917F01962528997\",signature=\"RceQoTq8wzC6vhDA91K6muUUPpTiaN6MXaqWl8/NlCari54jlijC4p2Ar2uitd7PxfY4490zvEp4wVub1HigwRhC5Wuw+v2A8fnQVGZ9BiYZiJ2ODqyxHyl7Z2530xOlx7ywvPWibRreN9h12r7zTyWGKjemQcNmuRp8vSnbwROnDp10+6wGgYi4C2bmAADBDMn2gscV78eDQT2OxDW8iZm8nOi5Pn41Vvw2QlTxv4A07t1v5SymqELaHuX/f8lRpIUvSke1p8VlZQslmBe32XVgLUdKo1A+rLG4SrR69C3j0gfTAbnEMjhFNRPTrJKuatNz2z8B40hdLEqUKUUcLw==\""
]
},
"body": "{\"out_trade_no\":\"20250404550101676642304\",\"description\":\"白色测试商品\",\"sub_mchid\":\"1898****865\",\"amount\":{\"total\":100},\"payer\":{\"sp_openid\":\"ooDnw61oUZXjzAm6S-Fgy3lo1M1k\"},\"settle_info\":{\"profit_sharing\":true},\"notify_url\":\"http:\\/\\/127.0.0.1:8000\\/api\\/pay\\/notify\\/100001\\/weapp\\/merchantpay\\/pay\",\"sp_appid\":\"wx02616f0c****37ca\",\"sp_mchid\":\"1685****917\"}"
},
"params": {
"out_trade_no": "20250404550101676642304",
"description": "白色测试商品",
"sub_mchid": "1898****865",
"amount": {
"total": 100
},
"payer": {
"sp_openid": "ooDnw61oUZXjzAm6S-Fgy3lo1M1k"
},
"settle_info": {
"profit_sharing": true
}
},
"payload": {
"out_trade_no": "20250404550101676642304",
"description": "白色测试商品",
"sub_mchid": "1898****865",
"amount": {
"total": 100
},
"payer": {
"sp_openid": "ooDnw61oUZXjzAm6S-Fgy3lo1M1k"
},
"settle_info": {
"profit_sharing": true
},
"_method": "POST",
"_url": "v3/pay/transactions/jsapi",
"_service_url": "v3/pay/partner/transactions/jsapi",
"notify_url": "http://127.0.0.1:8000/api/pay/notify/100001/weapp/merchantpay/pay",
"sp_appid": "wx02616f0c****37ca",
"sp_mchid": "1685****917",
"_body": "{\"out_trade_no\":\"20250404550101676642304\",\"description\":\"白色测试商品\",\"sub_mchid\":\"1898****865\",\"amount\":{\"total\":100},\"payer\":{\"sp_openid\":\"ooDnw61oUZXjzAm6S-Fgy3lo1M1k\"},\"settle_info\":{\"profit_sharing\":true},\"notify_url\":\"http:\\/\\/127.0.0.1:8000\\/api\\/pay\\/notify\\/100001\\/weapp\\/merchantpay\\/pay\",\"sp_appid\":\"wx02616f0c****37ca\",\"sp_mchid\":\"1685****917\"}",
"_authorization": "WECHATPAY2-SHA256-RSA2048 mchid=\"1685****917\",nonce_str=\"fl2GuaHAafnUCkaoXfUoBfWiAIpwOMhk\",timestamp=\"1743768110\",serial_no=\"1812A9AC856E06F15FF98FFD4917F01962528997\",signature=\"RceQoTq8wzC6vhDA91K6muUUPpTiaN6MXaqWl8/NlCari54jlijC4p2Ar2uitd7PxfY4490zvEp4wVub1HigwRhC5Wuw+v2A8fnQVGZ9BiYZiJ2ODqyxHyl7Z2530xOlx7ywvPWibRreN9h12r7zTyWGKjemQcNmuRp8vSnbwROnDp10+6wGgYi4C2bmAADBDMn2gscV78eDQT2OxDW8iZm8nOi5Pn41Vvw2QlTxv4A07t1v5SymqELaHuX/f8lRpIUvSke1p8VlZQslmBe32XVgLUdKo1A+rLG4SrR69C3j0gfTAbnEMjhFNRPTrJKuatNz2z8B40hdLEqUKUUcLw==\""
},
"packer": "Yansongda\\Artful\\Contract\\PackerInterface",
"direction": "Yansongda\\Artful\\Contract\\DirectionInterface",
"destination": {
"code": "SIGN_ERROR",
"message": "签名错误"
},
"destination_origin": {
"status": 401,
"headers": {
"Server": [
"nginx"
],
"Date": [
"Fri, 04 Apr 2025 12:01:51 GMT"
],
"Content-Type": [
"application/json; charset=utf-8"
],
"Content-Length": [
"46"
],
"Connection": [
"keep-alive"
],
"Keep-Alive": [
"timeout=8"
],
"Cache-Control": [
"no-cache, must-revalidate"
],
"X-Content-Type-Options": [
"nosniff"
],
"Request-ID": [
"08AE94BFBF0610D30718F6DB8C5820B3B70E28DFA703-268443699"
],
"Content-Language": [
"zh-CN"
]
},
"body": "{\"code\":\"SIGN_ERROR\",\"message\":\"签名错误\"}"
}
}
}
}
想问一下官方,这是什么原因呢
另外就是,如果知道在哪里通过Request-Id查询原因,我们也可以自查,但是我找了好久找不到
不贴代码就只能建议你使用sdkhttps://pay.weixin.qq.com/doc/v3/merchant/4012076498