在小程序中调用插件进行支付,在下单的时候将调用者小程序的appid传送到报文的sub_appid参数中去,系统成功返回了prepay_id等参数。但在小程序拉起支付的时候报错"支付验证签名失败",但是如果传宿主小程序appid或者不传到这个参数的时候,就不会出现拉起支付失败的情况;
请求报文如下
<xml>
<appid>
<![CDATA[wx720c7972a8ca3daf]]>
</appid>
<area_info>
<![CDATA[440112]]>
</area_info>
<body>
<![CDATA[阿强家酸菜鱼(百福广场店)]]>
</body>
<business>
<![CDATA[758]]>
</business>
<cert_id>
<![CDATA[4563293974]]>
</cert_id>
<channel_id>
<![CDATA[218587937]]>
</channel_id>
<channel_name>
<![CDATA[汇聚支付]]>
</channel_name>
<mch_id>
<![CDATA[1505695561]]>
</mch_id>
<merchant_name>
<![CDATA[广州市启正佳元科技有限公司]]>
</merchant_name>
<nonce_str>
<![CDATA[jPh9Lqf3DNR1zQpo]]>
</nonce_str>
<notify_url>
<![CDATA[http://xxx.xxx.xx:8090/netPay_channel_WEIXIN_TRADE_UNION.action]]>
</notify_url>
<openid>
<![CDATA[ovaiX4jfhvMM35ddRCt22SgqivuQ]]>
</openid>
<out_trade_no>
<![CDATA[100223103031687039]]>
</out_trade_no>
<sign>
<![CDATA[X9DIGt49F5lNC8YIJCkVLkWI2EXlZWASRSkhVwRNA25lFudux4+MOQ0/UG87IVG5w9Kg0zTqt9WTuLEDfl36cw==]]>
</sign>
<sign_type>
<![CDATA[SM2]]>
</sign_type>
<spbill_create_ip>
<![CDATA[10.40.50.58]]>
</spbill_create_ip>
<sub_appid>
<![CDATA[wx51d16cc6116c0c4e]]>
</sub_appid>
<sub_mch_id>
<![CDATA[589634745]]>
</sub_mch_id>
<time_start>
<![CDATA[20231030140749]]>
</time_start>
<total_fee>
<![CDATA[3]]>
</total_fee>
<trade_type>
<![CDATA[JSAPI]]>
</trade_type>
</xml>
返回报文:
"bankResult":{
"appid":"wx720c7972a8ca3daf",
"cert_id":"4233741533",
"mch_id":"1505695561",
"nonce_str":"aa30b0d2c78a4c79968c67b55a79ef60",
"prepay_id":"wx3014074964554972a2aef90dd0befc0000",
"result_code":"SUCCESS",
"return_code":"SUCCESS",
"return_msg":"成功",
"sign_type":"SM2",
"sub_appid":"wx51d16cc6116c0c4e",
"sub_mch_id":"589634745",
"trade_type":"JSAPI",
"wc_pay_data":"{\"appId\":\"wx51d16cc6116c0c4e\",\"timeStamp\":\"1698646069\",\"nonceStr\":\"77b32ae4c55b469ca6e0531afe465998\",\"package\":\"prepay_id=wx3014074964554972a2aef90dd0befc0000\",\"signType\":\"RSA\",\"paySign\":\"vypka3ww9mgwdcId4FI4RbkxHn+EXUmASYBMYA04yT2/+fOSM0pANvJPWFl8MOBr0yXcQgTmUNzECxQoIoyynXCyrJ0luB2r6Egd1aT24OqFQ2ppZH8z75neipGIYc5cvbAUJGFJoHWEIwfMJpesAVBLQnQxtorITlV8l3kmf9vByQOXYVbP15/cRYbXLSw2ZI2UYyAaXNF2UySR3db8mbGfzUXYRzi/BuYGgWKEpcOaZlEtFe6sCMolPl2T2DFoPhNza0RYg+cofmx6jWHIWMvANUMFBvLHVBhN1fDx5zmFNkyBA7niOI3y2YvUuRpD2IXGcc9kQ/+xYrJNSCMzfw==\"}"
},
"method":"json",
"paramMap":{
"result":"{\"appId\":\"wx51d16cc6116c0c4e\",\"timeStamp\":\"1698646069\",\"nonceStr\":\"77b32ae4c55b469ca6e0531afe465998\",\"package\":\"prepay_id=wx3014074964554972a2aef90dd0befc0000\",\"signType\":\"RSA\",\"paySign\":\"KEpcOaZlEtFe6sCMolPl2T2DFoPhNza0RYg+cofmx6jWHIWMvANUMFBvLHVBhN1fDx5zmFNkyBA7niOI3y2YvUuRpD2IXGcc9kQ/+xYrJNSCMzfw==\"}"
},
"paySign":"GZH",
"status":102
}
我这边已经拿到了prepay_id数据,但是前端调用wx.requestpayment接口时候,返回支付验证签名失败
拿到数据之后还需要二次签名,建议看一下开发文档?