asp 支付宝 企业版 接口 支持网银接口 ,网银直接支付
asp 支付宝 企业版 接口 支持网银接口 ,网银直接支付 仅仅是多了一个defalutbank的參数。
详细看
open.alipay.com
<%
' 类名:AlipaySubmit
' 功能:支付宝各接口请求提交类
' 具体:构造支付宝各接口表单HTML文本。获取远程HTTP数据
' 版本号:3.3
' 改动日期:2012-07-13
' 说明:
' 以下代码仅仅是为了方便商户測试而提供的例子代码,商户能够依据自己站点的须要,依照技术文档编写,并不是一定要使用该代码。
' 该代码仅供学习和研究支付宝接口使用,仅仅是提供一个參考
%> <!--#include file="alipay_config.asp"-->
<!--#include file="alipay_core.asp"--> <% '支付宝网关地址(新)
GATEWAY_NEW = "https://mapi.alipay.com/gateway.do?" Class AlipaySubmit ''
' 生成签名结果
' param sParaSort 待签名的数组
' return 签名结果字符串
Private Function BuildRequestMysign(sParaSort) '把数组全部元素,依照“參数=參数值”的模式用“&”字符拼接成字符串
prestr = CreateLinkstring(sParaSort) '获得签名结果
Select Case sign_type
Case "MD5" BuildRequestMysign = Md5Sign(prestr,key,input_charset)
Case Else BuildRequestMysign = ""
End Select
End Function ''
' 生成要请求给支付宝的參数数组
' param sParaTemp 请求前的參数数组
' return 要请求的參数数组
Private Function BuildRequestPara(sParaTemp)
Dim mysign
'过滤签名參数数组
sPara = FilterPara(sParaTemp) '对请求參数数组排序
sParaSort = SortPara(sPara) '获得签名结果
mysign = BuildRequestMysign(sParaSort) '签名结果与签名方式增加请求提交參数组中
nCount = ubound(sParaSort)
Redim Preserve sParaSort(nCount+1)
sParaSort(nCount+1) = "sign="&mysign
Redim Preserve sParaSort(nCount+2)
sParaSort(nCount+2) = "sign_type="&sign_type BuildRequestPara = sParaSort
End Function ''
' 生成要请求给支付宝的參数数组字符串
' param sParaTemp 请求前的參数数组
' return 要请求的參数数组字符串
Private Function BuildRequestParaToString(sParaTemp)
Dim sRequestData
'待签名请求參数数组
sPara = BuildRequestPara(sParaTemp)
'把參数组中全部元素,依照“參数=參数值”的模式用“&”字符拼接成字符串。而且对其做urlencode编码处理
sRequestData = CreateLinkStringUrlEncode(sPara) BuildRequestParaToString = sRequestData
End Function ''
' 建立请求。以表单HTML形式构造(默认)
' param sParaTemp 请求前的參数数组
' param sMethod 提交方式。 两个值可选:post、get
' param sButtonValue 确认button显示文字
' return 提交表单HTML文本
Public Function BuildRequestForm(sParaTemp, sMethod, sButtonValue)
Dim sHtml, nCount
'待请求參数数组
sPara = BuildRequestPara(sParaTemp) sHtml = "<form id='alipaysubmit' name='alipaysubmit' action='"& GATEWAY_NEW &"_input_charset="&input_charset&"' method='"&sMethod&"'>" nCount = ubound(sPara)
For i = 0 To nCount
'把sPara的数组里的元素格式:变量名=值,切割开来
iPos = Instr(sPara(i),"=") '获得=字符的位置
nLen = Len(sPara(i)) '获得字符串长度
sItemName = left(sPara(i),iPos-1) '获得变量名
sItemValue = right(sPara(i),nLen-iPos)'获得变量的值 sHtml = sHtml & "<input type='hidden' name='"& sItemName &"' value='"& sItemValue &"'/>"
next 'submitbutton控件请不要含有name属性
'submitbutton默认设置为不显示
sHtml = sHtml & "<input type='submit' value='"&sButtonValue&"' style='display:none;'></form>" sHtml = sHtml & "<script>document.forms['alipaysubmit'].submit();</script>" BuildRequestForm = sHtml
End Function Public Function BuildRequestFormbank( trade_no , subject , total_fee ,body ,show_url )
Dim sHtml sHtml = "<form name=alipayment action=alipayapi.asp method=post>" sHtml = sHtml & " <input size=""30"" name=""WIDout_trade_no"" type='hidden' value="""& trade_no &"""/>"
sHtml = sHtml & " <input size=""30"" name=""WIDsubject"" type='hidden' value="""& subject &"""/>"
sHtml = sHtml & " <input size=""30"" name=""WIDtotal_fee"" type='hidden' value="""& total_fee &"""/>"
sHtml = sHtml & " <input size=""30"" name=""WIDbody"" type='hidden' value="""& body &"""/>"
sHtml = sHtml & " <input size=""30"" name=""WIDshow_url"" type='hidden' value="""& show_url &"""/>" sHtml = sHtml & " <style>"
sHtml = sHtml & " ul.bank { padding:0px;margin-left:30px;}"
sHtml = sHtml & " ul.bank li { list-style:none; float:left; padding:5px;}"
sHtml = sHtml & " </style>"
sHtml = sHtml & ""
sHtml = sHtml & " <UL class=""bank fix"">"
sHtml = sHtml & " <LI><INPUT name=""WIDdefaultbank"" value=""ICBCB2C"" type=""radio""> "
sHtml = sHtml & " <IMG alt=""中国工商银行"" align=""middle"" src=""images/bank_gsyh2.gif"">"
sHtml = sHtml & " </LI>"
sHtml = sHtml & " <LI><INPUT name=""WIDdefaultbank"" value=""CMB"" type=""radio""> <IMG alt=""招商银行"""
sHtml = sHtml & " align=""middle"""
sHtml = sHtml & " src=""images/bank_zsyh2.gif""></LI>"
sHtml = sHtml & " <LI><INPUT name=""WIDdefaultbank"" value=""CCB"" type=""radio""> "
sHtml = sHtml & " <IMG alt=""中国建设银行"" align=""middle"""
sHtml = sHtml & " src=""images/bank_jsyh2.gif""></LI>"
sHtml = sHtml & " <LI><INPUT name=""WIDdefaultbank"" value=""ABC"" type=""radio""> "
sHtml = sHtml & " <IMG alt=""中国农业银行"" align=""middle"""
sHtml = sHtml & " src=""images/bank_nyyh2.gif""></LI>"
sHtml = sHtml & " <LI><INPUT name=""WIDdefaultbank"" value=""BOCB2C"" type=""radio""> "
sHtml = sHtml & " <IMG alt=""中国银行"" align=""middle"""
sHtml = sHtml & " src=""images/bank_zgyh2.gif""></LI>" sHtml = sHtml & " <LI><INPUT name=""WIDdefaultbank"" value=""COMM-DEBIT"" type=""radio""> "
sHtml = sHtml & " <IMG alt=""交通银行"" align=""middle"" src=""images/bank_jtyh.gif""></LI>"
sHtml = sHtml & " <LI><INPUT name=""WIDdefaultbank"" value=""CIB"" type=""radio""> "
sHtml = sHtml & " <IMG alt=""兴业银行"" align=""middle"" src=""images/bank_xyyh.gif""></LI>"
sHtml = sHtml & " <LI><INPUT name=""WIDdefaultbank"" value=""CMBC"" type=""radio""> "
sHtml = sHtml & " <IMG alt=""中国民生银行"" align=""middle"" src=""images/bank_msyh2.gif"">"
sHtml = sHtml & " </LI>"
sHtml = sHtml & " <LI><INPUT name=""WIDdefaultbank"" value=""GDB"" type=""radio""> <IMG alt=""广东发展银行"""
sHtml = sHtml & " align=""middle"""
sHtml = sHtml & " src=""images/bank_gdfz.gif""></LI>"
sHtml = sHtml & " <LI><INPUT name=""WIDdefaultbank"" value=""SPABANK"" type=""radio""> "
sHtml = sHtml & " 平安银行"
sHtml = sHtml & " </LI>"
sHtml = sHtml & " <LI><INPUT name=""WIDdefaultbank"" value=""SPDB"" type=""radio""> "
sHtml = sHtml & " <IMG alt=""上海浦东发展银行"" align=""middle"""
sHtml = sHtml & " src=""images/bank_pfyh.gif""></LI>"
sHtml = sHtml & " <LI><INPUT name=""WIDdefaultbank"" value=""CITIC"" type=""radio""> "
sHtml = sHtml & " <IMG alt=""中信银行"" align=""middle"" src=""images/bank_zxyh.gif""></LI>"
sHtml = sHtml & " <LI><INPUT name=""WIDdefaultbank"" value=""DEBIT"" type=""radio""> "
sHtml = sHtml & " <IMG alt=""光大银行"" align=""middle"" src=""images/bank_gdyh.gif""></LI>"
sHtml = sHtml & " <LI><INPUT name=""WIDdefaultbank"" value=""FDB"" type=""radio""> 富滇银行</LI>"
sHtml = sHtml & " <LI><INPUT name=""WIDdefaultbank"" value=""HZCBB2C"" type=""radio""> 杭州银行</LI>"
sHtml = sHtml & " <LI><INPUT name=""WIDdefaultbank"" value=""SHBANK"" type=""radio""> 上海银行</LI>"
sHtml = sHtml & " <LI><INPUT name=""WIDdefaultbank"" value=""NBBANK"" type=""radio""> 宁波银行</LI>"
sHtml = sHtml & " <LI><INPUT name=""WIDdefaultbank"" value=""POSTGC"" type=""radio""> 中国邮政储蓄银行</LI>"
sHtml = sHtml & " <LI><INPUT name=""WIDdefaultbank"" value=""BJBANK"" type=""radio""> 北京银行</LI>"
sHtml = sHtml & " <LI><INPUT name=""WIDdefaultbank"" value=""SHRCB"" type=""radio""> 上海农商银行</LI>"
sHtml = sHtml & " <LI><INPUT name=""WIDdefaultbank"" value=""WZCBB2C-DEBIT "" type=""radio""> 温州银行</LI>"
sHtml = sHtml & " <LI><INPUT name=""WIDdefaultbank"" value=""BJRCB"" type=""radio""> 北京农村商业银行</LI>"
sHtml = sHtml & " <LI><INPUT name=""WIDdefaultbank"" value=""abc1003"" type=""radio""> visa</LI>"
sHtml = sHtml & " <LI><INPUT name=""WIDdefaultbank"" value=""abc1004"" type=""radio""> master</LI>"
sHtml = sHtml & " </UL>" sHtml = sHtml & " <br><UL class=""bank fix"" style=""clear:both""><button class=""new-btn-login"" type=""submit"" style=""text-align:center;background-color: #ff8c00; color: #FFFFFF; font-weight: bold; "
sHtml = sHtml &"border: medium none; width:82px;height:28px;"">确 认</button></UL>" 'submitbutton控件请不要含有name属性
'submitbutton默认设置为不显示
'sHtml = sHtml & "<input type='submit' value='"&sButtonValue&"' style='display:none;'></form>"
sHtml = sHtml & "</form>" BuildRequestFormbank = sHtml
End Function ''
' 建立请求,以HTML形式构造(默认)
' param sParaTemp 请求前的參数数组
' param sMethod 提交方式。两个值可选:post、get
' param sButtonValue 确认button显示文字
' return 提交表单HTML文本
Public Function BuildRequestUrl(sParaTemp, sMethod, sButtonValue)
Dim sHtml, nCount
'待请求參数数组
sPara = BuildRequestPara(sParaTemp) sHtml = GATEWAY_NEW nCount = ubound(sPara)
For i = 0 To nCount
'把sPara的数组里的元素格式:变量名=值,切割开来
iPos = Instr(sPara(i),"=") '获得=字符的位置
nLen = Len(sPara(i)) '获得字符串长度
sItemName = left(sPara(i),iPos-1) '获得变量名
sItemValue = right(sPara(i),nLen-iPos)'获得变量的值 sHtml = sHtml & "&"& sItemName &"="& sItemValue
next
BuildRequestUrl= sHtml
End Function ''
' 建立请求。以模拟远程HTTP的GET请求方式构造并获取支付宝XML类型处理结果
' param sParaTemp 请求前的參数数组
' param sParaNode 要输出的XML节点名
' return 支付宝返回XML指定节点内容
Public Function BuildRequestHttpXml(sParaTemp, sParaNode)
Dim sUrl, objHttp, objXml, nCount, sParaXml()
nCount = ubound(sParaNode) '待请求參数数组字符串
sRequestData = BuildRequestParaToString(sParaTemp)
'构造请求地址
sUrl = GATEWAY_NEW & sRequestData '获取远程数据
Set objHttp=Server.CreateObject("Microsoft.XMLHTTP")
'假设Microsoft.XMLHTTP不行,那么请替换以下的两行行代码尝试
'Set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP.3.0")
'objHttp.setOption 2, 13056
objHttp.open "GET", sUrl, False, "", ""
objHttp.send()
Set objXml=Server.CreateObject("Microsoft.XMLDOM")
objXml.Async=true
objXml.ValidateOnParse=False
objXml.Load(objHttp.ResponseXML)
Set objHttp = Nothing set objXmlData = objXml.getElementsByTagName("alipay").item(0)
If Isnull(objXmlData.selectSingleNode("alipay")) Then
Redim Preserve sParaXml(1)
sParaXml(0) = "错误:非法XML格式数据"
Else
If objXmlData.selectSingleNode("is_success").text = "T" Then
For i = 0 To nCount
Redim Preserve sParaXml(i+1)
sParaXml(i) = objXmlData.selectSingleNode(sParaNode(i)).text
Next
Else
Redim Preserve sParaXml(1)
sParaXml(0) = "错误:"&objXmlData.selectSingleNode("error").text
End If
End If BuildRequestHttpXml = sParaXml
End Function ''
' 建立请求,以模拟远程HTTP的GET请求方式构造并获取支付宝纯文字类型处理结果
' param sParaTemp 请求前的參数数组
' return 支付宝处理结果
Public Function BuildRequestHttpWord(sParaTemp)
Dim sUrl, objHttp, sResponseTxt '待请求參数数组字符串
sRequestData = BuildRequestParaToString(sParaTemp)
'构造请求地址
sUrl = GATEWAY_NEW & sRequestData '获取远程数据
Set objHttp=Server.CreateObject("Microsoft.XMLHTTP")
'假设Microsoft.XMLHTTP不行。那么请替换以下的两行行代码尝试
'Set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP.3.0")
'objHttp.setOption 2, 13056
objHttp.open "GET", sUrl, False, "", ""
objHttp.send()
sResponseTxt = objHttp.ResponseText
Set objHttp = Nothing BuildRequestHttpWord = sResponseTxt
End Function ''
' 用于防钓鱼,调用支付宝防钓鱼接口(query_timestamp)来获取时间戳的处理函数
' 注意:远程解析XML出错,与IISserver配置有关
' return 时间戳字符串
Public Function Query_timestamp()
Dim sUrl, encrypt_key
sUrl = GATEWAY_NEW &"service=query_timestamp&partner="&partner&"&_input_charset="&input_charset
encrypt_key = "" Dim objHttp, objXml
Set objHttp=Server.CreateObject("Microsoft.XMLHTTP")
'假设Microsoft.XMLHTTP不行,那么请替换以下的两行行代码尝试
'Set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP.3.0")
'objHttp.setOption 2, 13056
objHttp.open "GET", sUrl, False, "", ""
objHttp.send()
Set objXml=Server.CreateObject("Microsoft.XMLDOM")
objXml.Async=true
objXml.ValidateOnParse=False
objXml.Load(objHttp.ResponseXML)
Set objHttp = Nothing Set objXmlData = objXml.getElementsByTagName("encrypt_key") '节点的名称
If Isnull(objXml.getElementsByTagName("encrypt_key")) Then
encrypt_key = ""
Else
encrypt_key = objXmlData.item(0).childnodes(0).text
End If Query_timestamp = encrypt_key
End Function End Class %>
如有疑问请加QQ群 348615323 网店系统开发群
asp 支付宝 企业版 接口 支持网银接口 ,网银直接支付的更多相关文章
- 无法获取链接服务器 "XXX" 的 OLE DB 访问接口 "SQLNCLI10" 的架构行集 "DBSCHEMA_TABLES_INFO"。该访问接口支持该接口,但使用该接口时返回了失败代码。
1. SQL 2000 下载补丁 SQL2KSP4 ,进行安装 2.找到SQL2KSP4\install\instcat.sql 并在sql2000 中打开查询分析器中执行
- ASP.NET Core WebApi构建API接口服务实战演练
一.ASP.NET Core WebApi课程介绍 人生苦短,我用.NET Core!提到Api接口,一般会想到以前用到的WebService和WCF服务,这三个技术都是用来创建服务接口,只不过Web ...
- Asp.Net Web Api 与 Andriod 接口对接开发经验,给小伙伴分享一下!
最近一直急着在负责弄Asp.Net Web Api 与 Andriod 接口开发的对接工作! 刚听说要用Asp.Net Web Api去跟 Andriod 那端做接口对接工作,自己也是第一次接触Web ...
- Asp.Net Web Api 与 Andriod 接口对接开发
Asp.Net Web Api 与 Andriod 接口对接开发经验,给小伙伴分享一下! 最近一直急着在负责弄Asp.Net Web Api 与 Andriod 接口开发的对接工作! 刚听说要用A ...
- C#/ASP.NET MVC微信公众号接口开发之从零开发(四) 微信自定义菜单(附源码)
C#/ASP.NET MVC微信接口开发文章目录: 1.C#/ASP.NET MVC微信公众号接口开发之从零开发(一) 接入微信公众平台 2.C#/ASP.NET MVC微信公众号接口开发之从零开发( ...
- C#/ASP.NET MVC微信公众号接口开发之从零开发(三)回复消息 (附源码)
C#/ASP.NET MVC微信接口开发文章目录: 1.C#/ASP.NET MVC微信公众号接口开发之从零开发(一) 接入微信公众平台 2.C#/ASP.NET MVC微信公众号接口开发之从零开发( ...
- Windows7下出现“不支持此接口”的解决方案
今天学校里的辅导员突然找到我说Windows 7下什么文件夹都打不开了,提示“不支持此接口”.怀疑是病毒所致,但运行杀毒软件没有结果.重启也问题依旧. 上网查了之后找到了修复方法: 在命令行中输入fo ...
- _ConnectionPtr.CreateInstance(__uuidof(Connection))“不支持此接口”错误解决
最近在换了win7 64位的系统,今天突然发现以前写的ADO连接数据库的代码编译后在windows2003下会执行到: _ConnectionPtr.CreateInstance(__uuidof(C ...
- 微信小程序语音识别服务搭建全过程解析(https api开放,支持新接口mp3录音、老接口silk录音)
silk v3(或新录音接口mp3)录音转olami语音识别和语义处理的api服务(ubuntu16.04服务器上实现) 重要的写在前面 重要事项一: 所有相关更新,我优先更新到我个人博客中,其它地方 ...
随机推荐
- 【图论】The Bottom of a Graph
[POJ2553]The Bottom of a Graph Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 11182 ...
- 【BFS】【位运算】解药还是毒药
[codevs2594]解药还是毒药 Description Smart研制出对付各种症状的解药,可是他一个不小心,每种药都小小地配错了一点原料,所以这些药都有可能在治愈某些病症的同时又使人患上某些别 ...
- 【随机化】Petrozavodsk Summer Training Camp 2016 Day 5: Petr Mitrichev Contest 14, Saturday, August 27, 2016 Problem I. Vier
给你一个1~n的排列,让你找出4个下标a b c d,满足 (a+b)%n=(c+d)%n (w(a)+w(b))%n=(w(c)+w(d))%n,并且是非平凡解. 发现对于每个数i,找出两个数和为其 ...
- 【模拟】Gym - 101190A - Abbreviation
让你把所有的“连续的仅有首字母大写的”词组用缩写表示,并且在后面用括号注明原词组. #include<cstdio> #include<cstring> using names ...
- Idea集成svn
Idea集成svn 既然要使用svn,首先需要下载一个 svn的客户端,到这里下载对应的安装程序:http://subversion.apache.org/packages.html#windows ...
- fastjson生成json时Null属性不显示的解决方法
举个例子 Map < String , Object > jsonMap = new HashMap< String , Object>(); jsonMap.put(&quo ...
- [转]SSH包全解
Struts2 Core Libraries 必须引入的包 : struts2-core.jar——Struts2的核心包 xwork-core.jar——Command模式框架,WebWork和St ...
- Codeforces Beta Round #2 A. Winner 水题
A. Winner 题目连接: http://www.codeforces.com/contest/2/problem/A Description The winner of the card gam ...
- Codeforces Round #345 (Div. 2) B. Beautiful Paintings 暴力
B. Beautiful Paintings 题目连接: http://www.codeforces.com/contest/651/problem/B Description There are n ...
- Hiho----有向图欧拉回路
时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 小Hi和小Ho破解了一道又一道难题,终于来到了最后一关.只要打开眼前的宝箱就可以通关这个游戏了. 宝箱被一种奇怪的机关锁住 ...