• MUI 微信支付代码


    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title></title>
    <script src="js/mui.min.js"></script>
    <link href="css/mui.min.css" rel="stylesheet"/>
    <script type="text/javascript" charset="utf-8">
    mui.init();
    var channel = null;
    var channels = null;
    // 1. 获取支付通道
    function plusReady() {
    // 获取支付通道
    plus.payment.getChannels(function(cs) {
    channels = cs;

    },
    function(e) {
    alert("获取支付通道失败:" + e.message);
    });
    }
    document.addEventListener('plusready', plusReady, false);
    // var ALIPAYSERVER = 'http://demo.dcloud.net.cn/helloh5/payment/alipay.php?total=';
    //var WXPAYSERVER = 'http://www.m.rfvip.cn:20677/WX/index?payid=wxpay&appid=wx84f0ceea370f1748&total=1';
    // var WXPAYSERVER = 'http://www.m.rfvip.cn:20677';
    //var WXPAYSERVER='http://demo.dcloud.net.cn/helloh5/payment/wxpay.php?total=1';
    // 2. 发起支付请求
    function pay(id) {



    for (var i in channels)
    {
    if (channels[i].id == id)
    {
    channel = channels[i];
    }
    }

    // var varpay = {
    // appid: "wx0411fa6a39d61297",//
    // noncestr: "9AkU7zoEckVt9I8Z",//随意字符串
    // package: "Sign=WXPay",//调用包
    // partnerid: "1230636401",//商户ID
    // prepayid: "wx05112714955769c027b7a14b1981808800",//订单ID
    // timestamp: "1562297234",//时间戳
    // sign: "75967CB53A2E23D420B9722BBE666080"//签名
    // }

    var varpay = {
    appid: "*****",//
    noncestr: "tSC7MZWeUcg3lDbn",//随意字符串
    package: "Sign=WXPay",//调用包
    partnerid: "*****",//商户ID
    prepayid: "wx05135935000398f304f8cfcc1783723100",//订单ID
    timestamp: "1562306375",//时间戳
    sign: "BD23EB2BD9D768C01F4544B417BB0DA5"//签名
    }

    // console.log("appid==>"+varpay.appid);
    // console.log("noncestr==>"+varpay.noncestr);
    // console.log("package==>"+varpay.package);
    // console.log("partnerid==>"+varpay.partnerid);
    // console.log("prepayid==>"+varpay.prepayid);
    // console.log("timestamp==>"+varpay.timestamp);
    // console.log("sign==>"+varpay.sign);

    plus.payment.request(channel, varpay, function(result) {
    plus.nativeUI.alert("支付成功!", function() {
    back();
    });
    }, function(e) {
    plus.nativeUI.alert("支付失败:" + e.code + "支付失败:" + e.message);
    console.log(e.code);
    console.log(e.message);
    });

    /* xhr.open('GET',PAYSERVER);
    xhr.send();*/
    }
    </script>
    </head>
    <body>
    <header class="mui-bar mui-bar-nav">
    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
    <h1 class="mui-title">支付测试123456</h1>
    </header>
    <div class="mui-content">
    <input type="button" class="btn btn-lg" id="pay" value="微信支付" onclick="pay('wxpay')" />
    </div>

    </body>
    </html>

    备注:注意APPID 必须为APP应用ID  

  • 相关阅读:
    GB/T 38879-2020 颗粒 粒度分析 彩色图像分析法
    GB/T 30431-2020 实验室气相色谱仪
    GB/T 50165-2020 古建筑木结构维护与加固技术标准
    GB/T 51405-2019 船厂总体设计标准
    GB/T 38922-2020 35kV及以下标准化继电保护装置通用技术要求
    GB/T 38953-2020 微电网继电保护技术规定
    GB/T 38886-2020 高温轴承钢等最新国家标准(2020-6-19)
    pytest_02(使用pychar执行pytest)
    pytest-01(安装pytest及运行规则)
    python-05(关于map函数的使用)
  • 原文地址:https://www.cnblogs.com/bug123456/p/11138021.html
Copyright © 2020-2023  润新知