https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=7_7&index=6
function onBridgeReady(){
WeixinJSBridge.invoke(
'getBrandWCPayRequest', {
"appId":"wx2421b1c4370ec43b", //公眾號名稱坦敌,由商戶傳入
"timeStamp":"1395712654", //時間戳酬姆,自1970年以來的秒數(shù)
"nonceStr":"e61463f8efa94090b1f366cccfbbb444", //隨機(jī)串
"package":"prepay_id=u802345jgfjsdfgsdg888",
"signType":"MD5", //微信簽名方式:
"paySign":"70EA570631E4BB79628FBCA90534C63FF7FADD89" //微信簽名
},
function(res){
if(res.err_msg == "get_brand_wcpay_request:ok" ) {} // 使用以上方式判斷前端返回,微信團(tuán)隊鄭重提示:res.err_msg將在用戶支付成功后返回 ok,但并不保證它絕對可靠急迂。
}
);
}
if (typeof WeixinJSBridge == "undefined"){
if( document.addEventListener ){
document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
}else if (document.attachEvent){
document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
}
}else{
onBridgeReady();
}