• <menu id="smwsk"><strong id="smwsk"></strong></menu>
    <menu id="smwsk"><strong id="smwsk"></strong></menu>
  • <menu id="smwsk"><tt id="smwsk"></tt></menu>
  • 歡迎來到安信科技官方網站!【www.timetechnb.com】
    18112005550
    工作時間: 8:30-21:30
    新聞中心
    News Center

    微信公眾號支付ASP源碼下載(接口文件)

    資訊分類: 資源共享  瀏覽: 2017年6月29日
    接口程序文件源碼:wxpay.asp
     
    本頁應該包含該頁面http://www.timetechnb.com/news/92.html的類文件:include file="weipay.class.asp"
    '   注意:本頁面必須是 UTF-8編碼
    '   本頁面為偽代碼,代碼不全,僅是為了演示用法
     
    set wechat = new WeChatPay()
     
    out_trade_no = request("trade_no")
     
    set rs.open "select * from order_list where o_status='未支付' and o_tradeno='" & out_trade_no & "'", conn, 3, 2
     
    '創建支付
    if request("action") = "ajax" then
        '創建訂單
     
        if rs.eof then
            result = wechat.Pay("訂單號", "產品名", "不需要傳值,此值暫時無用,為了與支付寶保持兼容", "支付金額,單位元")
            if left(result, 15) = "weixin://wxpay/" then
               '支付成功,返回 支付鏈接,通過前臺 ajax 返回到前臺,通過 jQuery.qrcode 插件二維碼
                 response.write "{""status"":true, ""payUrl"":""" & result & """}"
            else
                '支付失敗,返回錯誤信息
                response.write "{""status"":false, ""errMsg"":""" & result & """}"
            end if
        else
            response.write "{""status"":false, ""errMsg"":""已經處理完畢""}"
        end if
    else request("action") = "check" then
        '檢查支付狀態,【微信支付后臺通知(異步)】設為 完成后,返回成功
         
        '如果 當前訂單不是 未支付狀態了,說明已經支付
        if rs.eof then
            response.write "{""status"":true}""
        else
            response.write "{""status"":false}""
        end if
    else
         
        '微信支付后臺通知(異步)
        set result = wechat.GetNotify()
        if result.item("status") = false then
            '校驗失敗
            response.write result.item("message")
        else
            '校驗成功,修改o_status為已支付
            if not rs.eof then
                rs("wx_tradeno") = trade_no
                rs("o_paytme") = now()
                rs("o_status") = "已支付"
                rs.update
            end if
            response.write "<return_code>SUCCESS</return_code><return_msg>OK</return_msg>"
        end if
     
    end if
     
    3.Ajax前臺創建支付請求和刷新訂單狀態的方法
    $(function(){
        $.ajax({
            url : "/wxapi.asp?action=ajax&trade_no=<% =trade_no %>",
            dataType : "json",
            type : "GET",
            success : function(result){
                if( result.status != true ){
                    alert(result.errMsg);
                }else{
                    jQuery('#qrcodeCanvas').html("").qrcode({
                        text : result.payUrl
                    });
                    setTimeout(function(){
                        jQuery('#qrcodeImage img').attr("src", $("#qrcodeCanvas canvas")[0].toDataURL("image/png"));
                    }, 100);
                    setInterval(function(){
                        $.ajax({
                            url : "/wxapi.asp?action=check&trade_no=<% =trade_no %>",
                            dataType : "json",
                            success : function(result){
                                if( result.status === false ){
                                    alert("支付成功");
                                    location.href = "?action=info&trade_no=<% =trade_no %>";
                                }
                            }
                        });
                    }, 5000);
                }
            }
        });
    })
    Copyright © 2007-2022 安信科技(十五周年紀念版) All Rights Reserved  備案號:蘇ICP備15047094號-3 
    網站首頁 |  新聞資訊 |  服務項目 |  軟件產品 |  試用下載 |  需求提交 |  模版建站 |  關于安信 |  產品授權 |  聯系我們 |  定制開發 | 
    服務熱線:181-1200-5550  客服QQ: 120094883  | 郵箱:120094883#qq.com(#改@)  
    欧美黑白配性xxxxx