请教大佬
统一接口返回数据:
<xml><return_code><![CDATA[SUCCESS]]></return_code>
<return_msg><![CDATA[OK]]></return_msg>
<appid><![CDATA[wx6e6d495db360e1b5]]></appid>
<mch_id><![CDATA[1548332151]]></mch_id>
<nonce_str><![CDATA[EOaGB1JZkFdpBM02]]></nonce_str>
<sign><![CDATA[F62562B0EEB8BAC8FC4869E0F94BA09D]]></sign>
<result_code><![CDATA[SUCCESS]]></result_code>
<prepay_id><![CDATA[wx07014203672727c1f5beeaf41400305600]]></prepay_id>
<trade_type><![CDATA[JSAPI]]></trade_type>
</xml>
二次签名处理::
{'appid': 'wx6e6d495db360e1b5', 'mch_id': '1548332151', 'nonce_str': 'H2HGAVQR7VFXLE41GSBECX45OT02K0PC', 'openid': 'o7AzAs_s-cHMlC53HxxIWFqq395k', 'body': '这里是body', 'out_trade_no': '2019090617420362', 'total_fee': '50', 'spbill_create_ip': '124.133.137.211', 'trade_type': 'JSAPI', 'notify_url': '************', 'sign': 'BB571C77D9EB891E6F8B8FF043611E8E', 'prepay_id': 'wx07014203672727c1f5beeaf41400305600', 'package': 'prepay_id=wx07014203672727c1f5beeaf41400305600', 'timestamp': '1567791723', 'signType': 'MD5'}
前端html:
返回失败 : get_brand_wcpay_request:fail
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>支付</title>
</head>
<body>
"appId": {{ appid }}, //公众号名称,由商户传入
"timeStamp": {{ timestamp }}, //时间戳,自1970年以来的秒数
"nonceStr": {{ nonce_str }}, //随机串
"package": {{ package }},
"signType": {{ signType }}, //微信签名方式:
"paySign": {{ sign }} //微信签名
<p id="test">哈哈哈</p>
<script>
if (typeof WeixinJSBridge == "undefined") {
document.getElementById("test").innerHTML = "321";
if (document.addEventListener) {
document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
} else if (document.attachEvent) {
document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
}
} else {
onBridgeReady();
}
function onBridgeReady() {
document.getElementById("test").innerHTML = "Hello javascript!";
WeixinJSBridge.invoke(
'getBrandWCPayRequest', {
"appId": {{ appid }}, //公众号名称,由商户传入
"timeStamp": {{ timestamp }}, //时间戳,自1970年以来的秒数
"nonceStr": {{ nonce_str }}, //随机串
"package": {{ package }},
"signType": {{ signType }}, //微信签名方式:
"paySign": {{ sign }} //微信签名
},
function (res) {
if (res.err_msg == "get_brand_wcpay_request:ok") {
// 使用以上方式判断前端返回,微信团队郑重提示:
//res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
}
});
}
</script>
</body>
</html>