problem description
Hello, bosses. I was just reading WeChat Pay"s document. I"m confused about a small problem. I hope the bosses can give me some advice.
the environmental background of the problems and what methods you have tried
related codes
/ / Please paste the code text below (do not replace the code with pictures)
initiate a WeChat Pay request
wx.chooseWXPay ({
timestamp: 0, // jssdktimestamptimeStampS
nonceStr: "", // 32
package: "", // prepay_id:prepay_id=\*\*\*
signType: "", // "SHA1""MD5"
paySign: "", //
success: function (res) {
//
}
});
this is on the document, where the payment is successful in success, but there is also a
function onBridgeReady () {
WeixinJSBridge.invoke (
"getBrandWCPayRequest", {
"appId":"wx2421b1c4370ec43b", //
"timeStamp":"1395712654", //1970
"nonceStr":"e61463f8efa94090b1f366cccfbbb444", //
"package":"prepay_id=u802345jgfjsdfgsdg888",
"signType":"MD5", //:
"paySign":"70EA570631E4BB79628FBCA90534C63FF7FADD89" //
},
function(res){
if(res.err_msg == "get_brand_wcpay_request:ok" ){
// ,:
//res.err_msgok
}
});
}
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 ();
}
this method, there is a res.err_msg = = "get_brand_wcpay_request:ok" is also a successful payment ah,
emmmm, so which one to use? Is there any difference between the two? Or both?