zoukankan      html  css  js  c++  java
  • 微信支付

    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);
        }
      }

    }

  • 相关阅读:
    数据库
    poj上关于回文的题目
    最长上升子序列
    [CodeForces]914D Bash and a Tough Math Puzzle
    [HAOI2011]problem a
    Arc123 D
    [Cnoi2020]线性生物
    [USACO17FEB]Why Did the Cow Cross the Road III P
    ABC 210
    CF1111D Destroy the Colony
  • 原文地址:https://www.cnblogs.com/92xcd/p/9449407.html
Copyright © 2011-2022 走看看