基本信息
源码名称:ASP微信支付2.0版本demo集成(测试版)
源码大小:0.22M
文件格式:.rar
开发语言:PHP
更新时间:2018-01-10
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 10 元 
   源码介绍
ASP微信支付2.0版本demo集成

众所周知,目前微信支付已经十分普及,无论是商场、超市、网站上,微信支付的发展十分迅速,而ASP版微信支付在微信公众平台上并没有提供,而目前基于ASP语言开发的网站又十分普遍,因此这类网站集成微信支付就十分不便。
基于此,我们根据微信官网提供的开放API,独立开发了微信支付的各种支付接口,包括:微信扫码支付、微信公众号支付、微信红包支付、微信刷卡支付等一系列接口,供所有ASP代码的网站使用。

   ASP扫码支付是用的最普遍的一种接口,所有ASP的网站都可以整合使用,可以实现支付下单结果返回,并入库自动更新订单操作,我们提供一切ASP网站上关于微信支付的定制服务,如有需要可与我们联系。

   微信公众号支付是基于微信公众号而开发的支付接口,在已有的公众号里可以添加ASP的公众号支付,微信中生成订单后,可以直接调出微信钱包直接支付,非常方便,同样支持自动更新订单状态,刷卡支付则适用于商场类的POS机操作,一般网站上不需要。

   基于此,我们根据微信官网提供的开放API,独立开发了微信支付的各种支付接口,包括:微信扫码支付、微信公众号支付、微信红包支付、微信刷卡支付等一系列接口,供所有ASP代码的网站使用。

   ASP扫码支付是用的最普遍的一种接口,所有ASP的网站都可以整合使用,可以实现支付下单结果返回,并入库自动更新订单操作,我们提供一切ASP网站上关于微信支付的定制服务,如有需要可与我们联系。

   微信公众号支付是基于微信公众号而开发的支付接口,在已有的公众号里可以添加ASP的公众号支付,微信中生成订单后,可以直接调出微信钱包直接支付,非常方便,同样支持自动更新订单状态,刷卡支付则适用于商场类的POS机操作,一般网站上不需要。



核心代码如下:

<%
'======================================
'系统:微信扫码支付程序
'功能:微信扫码支付接口调试入口页面
'作者:PayAsp.com
'Q  Q:24147824
'官网:http://www.PayAsp.com
'======================================
%>
<!--#include file="wxpay.Api.asp" -->
<!--#include file="WxApi.asp" -->
<%
 set wxpay = New WxPayApi
Dim Action,total_fee
    Action = Trim(Request.QueryString("action"))
	If Action = "pay" Then
	   auth_code = Trim(Request.form("auth_code"))
	   total_fee = Trim(Request.form("total_fee"))
   Dim body,out_trade_no,attach
   body = "微信刷卡支付(WxPay)"
   out_trade_no = wxpay.GetDateTime
   attach = "目于网络"'商户自定义数据包.

    wxpay.setParameter "body",body
	wxpay.setParameter "out_trade_no",out_trade_no
	wxpay.setParameter "attach",attach
	wxpay.setParameter "total_fee",(total_fee)*100
	wxpay.setParameter "spbill_create_ip","127.0.0.1"
	wxpay.setParameter "device_info","123456789"
	wxpay.setParameter "auth_code",Right(auth_code,len(auth_code)-Instr(auth_code,","))

	xml = wxpay.Get_micropay()
	
	result = wxpay.Get_Xml_Text(xml,"//result_code")
	If result = "SUCCESS" Then
	   wxpay.Die "付款成功!"
	Else
	   wxpay.Die wxpay.Get_Xml_Text(xml,"//err_code_des")
	End If
	Else
SET Wx = New WxAPI
     If Request.Cookies("token")="" Then
	    Call wx.Get_Token()
	 End If 
     ticket = wx.Get_Ticket()
	 'response.Write(ticket)
Set Wx=Nothing


	    Dim Str,signature,timestamp,nonceStr,url
		timestamp = Datediff("s","1970-01-01 00:00:00",now)
		nonceStr = wxpay.MakeRandStr(32)
        url = "http://"&request.ServerVariables("HTTP_HOST")&request.ServerVariables("URL")
		If Trim(Request.QueryString)<>"" Then
           url = url&"?"&Trim(Request.QueryString)
		End If		
		'Response.Write(url)
        Str = "jsapi_ticket="&ticket&"&noncestr="&nonceStr&"&timestamp="&timestamp&"&url="&url
		signature = SHA1(Str)
		'Response.Write(signature)

End If
 set wxpay = Nothing
 %>
<html>
<head>
    <meta http-equiv="content-type" content="text/html;charset=gb2312"/>
    <meta name="viewport" content="width=device-width, initial-scale=1" /> 
    <title>微信支付样例</title>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script>

  wx.config({
    debug: false,
    appId: '<%= APPID %>',
    timestamp: <%= timestamp %>,
    nonceStr: '<%= nonceStr %>',
    signature: '<%= signature %>',
    jsApiList: [
        'checkJsApi',
        'onMenuShareTimeline',
        'onMenuShareAppMessage',
        'onMenuShareQQ',
        'onMenuShareWeibo',
        'onMenuShareQZone',
        'hideMenuItems',
        'showMenuItems',
        'hideAllNonBaseMenuItem',
        'showAllNonBaseMenuItem',
        'translateVoice',
        'startRecord',
        'stopRecord',
        'onVoiceRecordEnd',
        'playVoice',
        'onVoicePlayEnd',
        'pauseVoice',
        'stopVoice',
        'uploadVoice',
        'downloadVoice',
        'chooseImage',
        'previewImage',
        'uploadImage',
        'downloadImage',
        'getNetworkType',
        'openLocation',
        'getLocation',
        'hideOptionMenu',
        'showOptionMenu',
        'closeWindow',
        'scanQRCode',
        'chooseWXPay',
        'openProductSpecificView',
        'addCard',
        'chooseCard',
        'openCard'
      ]
  });  
  wx.ready(function () {
  document.querySelector('#scanQRCode1').onclick = function () {
    wx.scanQRCode({
    needResult:1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
    //scanType: ["qrCode","barCode"], // 可以指定扫二维码还是一维码,默认二者都有
    success: function (res) {
	//alert(res);
    //var result = res.resultStr; // 当needResult 为 1 时,扫码返回的结果
	document.getElementById('auth_code').value = res.resultStr;
}
});
  };
});  
</script>
</head>

<body>  
	<form action="?action=pay" method="post">
        <div style="margin-left:2%;">商品描述:</div><br/>
        <input type="text" style="width:96%;height:35px;margin-left:2%;" readonly value="刷卡测试样例-支付" name="auth_code1" /><br /><br />
        <div style="margin-left:2%;">支付金额:元</div><br/>
        <input type="text" style="width:96%;height:35px;margin-left:2%;" value="0.01" name="total_fee" /><br /><br />
        <div style="margin-left:2%;">授权码:</div><br/>
        <input type="text" style="width:96%;height:35px;margin-left:2%;" name="auth_code" id="auth_code" /><br /><br />
       	<div align="center">
      <span style="width:150px; padding:16px; height:50px; border-radius: 15px;background-color:#FE6714; border:0px #FE6714 solid; cursor: pointer;  color:white;  font-size:16px;" id="scanQRCode1">扫描微信付款码</span>
	<input type="submit" value="提交刷卡" style="width:150px; height:50px; border-radius: 15px;background-color:#FE6714; border:0px #FE6714 solid; cursor: pointer;  color:white;  font-size:16px;"/>
		</div>
	</form>
	<script src="zepto.min.js"></script>
</body>
</html>