WeChat Pay asks a small question.

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 (

) on the document.
  "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?

Oct.25,2021

first of all, I am honored to be invited to answer. Just choose one of
WeixinJSBridge and chooseWXPay, but the encapsulation inside is different, but
1 and chooseWXPay must be used after wx.config.
2, parameters are different. WeixinJSBridge requires appId, while chooseWXPay does not need to be added after config (pay attention to the case of parameters).
in addition can also be referenced.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e421be-4c093.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e421be-4c093.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?