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

    客户端

    <!DOCTYPE html>
    <html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">
        <head>
            <title></title>
            <meta charset="utf-8">
            <meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
            <link rel="stylesheet" href="css/fonts/font-awesome.min.css">
            <link rel="stylesheet" href="css/ui-box.css">
            <link rel="stylesheet" href="css/ui-base.css">
            <link rel="stylesheet" href="css/ui-color.css">
            <link rel="stylesheet" href="css/appcan.icon.css">
            <link rel="stylesheet" href="css/appcan.control.css">
            <link rel="stylesheet" type="text/css" href="css/index.css">
            <script type="text/javascript">
    
        var prepayId;
        function getPrepayId(){
          //  alert('getPrepayId');
          $.ajax({
            url : 'http://www.网址.com/index.php?g=api&m=Api&a=getPrepayId',
            type : "post",
            data : {
                order_no:订单号,
                uid: uid,
            },
            datatype : "json",
            timeout : 30000,
            success : function(data, status, requestCode, response, xhr) {
                data = JSON.parse(data);
                if (data.code == 1) {
                    alert(1);
                    var params = data.data;
                    var data = JSON.stringify(params);
                    alert(data);
                    uexWeiXin.getPrepayId(data);
                } else {
                    alert(0);
                    alert(data.tips);
                }
            },
            error : function(xhr, erroType, error, msg) {
                alert('网络问题');
            }
        });
         
        }
        function startPay(){
            alert(prepayId);
          $.ajax({
            url : 'http://网址.com/index.php?g=api&m=Api&a=startPay',
            type : "POST",
            data : {
                prepayid:prepayId,
                noncestr:'weradfdgdvccfexs1',
            },
            datatype : "json",
            timeout : 30000,
            success : function(data, status, requestCode, response, xhr) {
                data = JSON.parse(data);
                if (data.code == 1) {
                    var params = data.data;
                     var data = JSON.stringify(params);
                     uexWeiXin.startPay(data);
                } else {
                    alert(data.tips);
                }
    
            },
            error : function(xhr, erroType, error, msg) {
                appcan.window.openToast("获取数据失败", 2000, 5, 0);
            }
        });
        
           
        }
    //注册回调函数 window.uexOnload
    = function(){ uexWeiXin.cbGetPrepayId = cbGetPrepayId; uexWeiXin.cbStartPay = cbStartPay; } function cbGetPrepayId(info){ console.log(info); alert(info); prepayId = JSON.parse(info).prepay_id; alert('prepayId:'+prepayId); } function cbStartPay(info){ console.log(info); alert('支付成功:'+info); } </script> </head> <body class="um-vp bc-bg" ontouchstart> <div class="tit">支付</div> <div class="conbor"> <div class="consj"> <input class='btn' type='button' value='getPrepayId' onclick='getPrepayId()'> <input class='btn' type='button' value='startPay' onclick='startPay()'> </div> </div> </body> <script src="js/appcan.js"></script> <script src="js/appcan.control.js"></script> </body> <script> appcan.ready(function() { uexWeiXin.registerApp('wx4705bd987b714abb'); }); </script> </html>

    php 服务器端 

      

  • 相关阅读:
    账户与安全
    VIM 文档编辑
    ubuntu下搭建Discuz
    数据库管理及增删改查基本操作小结
    poj 3320 jessica's Reading PJroblem 尺取法 -map和set的使用
    poj 3579 Median 二分套二分 或 二分加尺取
    poj 3685 Matrix 二分套二分 经典题型
    POJ 3061  Subsequence   尺取法   挑战146页
    poj 2976 Dropping tests 二分搜索+精度处理
    Codeforces Round #325 (Div. 2) A. Alena's Schedule 暴力枚举 字符串
  • 原文地址:https://www.cnblogs.com/tingfengqieyu/p/5338096.html
Copyright © 2011-2022 走看看