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 服务器端 

      

  • 相关阅读:
    微软企业库Enterprise Library学习笔记一
    ASP.net的地址重写(URLRewriter)实现原理及代码示例
    Naive Bayes text classification
    [转]select、poll、epoll的比较
    linux 异步file I/O操作示例
    [转]Linux动态库(.so)搜索路径
    [转]python urllib2
    What is Third party cookie definition
    linux 相关工具
    关于最大熵模型
  • 原文地址:https://www.cnblogs.com/tingfengqieyu/p/5338096.html
Copyright © 2011-2022 走看看