标签:ref can == mes 可靠 xxx doc ready bsp
onBridgeReady: function(params) { //微信支付
var params =
{
"timeStamp": "",
"package": "",
"paySign": "",
"appId": "",
"signType": "",
"nonceStr": ""
};
WeixinJSBridge.invoke(
‘getBrandWCPayRequest‘, params,
function(res) {
if(res.err_msg == "get_brand_wcpay_request:ok") { //支付成功
location.href = ‘xxx.html‘;//跳往指定的页面
}else if(res.err_msg == "get_brand_wcpay_request:cancel"){//取消支付
alert(‘取消支付!‘);
}else{ // 使用以上方式判断前端返回,微信团队郑重提示:res.err_msg将在用户支付成功后返回 ok,但并不保证它绝对可靠。
alert(‘支付失败!‘);
}
}
);
if(typeof WeixinJSBridge == "undefined") {
if(document.addEventListener) {
document.addEventListener(‘WeixinJSBridgeReady‘, this.onBridgeReady, false);
} else if(document.attachEvent) {
document.attachEvent(‘WeixinJSBridgeReady‘, this.onBridgeReady);
document.attachEvent(‘onWeixinJSBridgeReady‘, this.onBridgeReady);
}
}
}
标签:ref can == mes 可靠 xxx doc ready bsp
原文地址:https://www.cnblogs.com/92xcd/p/9449407.html