转一个支付宝接口的ASP代码 支付宝接口(应用实例)2008-08-22 16:33支付宝接口的ASP代码
<% Dim clsAlipay Dim strNotify, strTradeURL, strShoppingBagID Dim intPrice Dim dtmNow Set clsAlipay = New Cls_Alipay intPrice = 0.01 dtmNow = Now() '交易号 Randomize 'RND strShoppingBagID = Year(dtmNow) & Right("0" & Month(dtmNow), 2) & Right("0" & Day(dtmNow), 2) & Right("0" & Hour(dtmNow), 2) & Right("0" & Minute(dtmNow), 2) & Right("0" & Second(dtmNow), 2) & Right("000000" & Rnd * 1000000, 6) Set clsAlipay = New Cls_Alipay '支付宝交易类 ' 生成支付宝交易地址 clsAlipay.key = "" '安全校验码 clsAlipay.Input.partner = "" '合作伙伴ID clsAlipay.Input.service = "create_direct_pay_by_user" '接口名称.即时到帐交易 clsAlipay.Input.payment_type = "1" '支付类型 clsAlipay.Input.show_url = "" '商品展示网址 'clsAlipay.Input.notify_url = strSiteDomain & "/personal/alipay_notify.asp" '通知URL clsAlipay.Input.notify_url = "http://project.sotong.cn/personal/alipay_notify.asp" clsAlipay.Input.return_url = "" '返回URL clsAlipay.Input.input_charset = "utf-8" 'gbk/utf-8 clsAlipay.Input.subject = "用户充值" clsAlipay.Input.body = "" clsAlipay.Input.discount = "0" clsAlipay.Input.out_trade_no = strShoppingBagID clsAlipay.Input.total_fee = intPrice clsAlipay.Input.seller_email = "" strTradeURL = clsAlipay.TradeURL If clsAlipay.ErrCodes > 0 Then Response.write clsAlipay.Description '如果出错显示错误提示 Response.Write "
go alipay.com" Response.Write "
" ' 支付宝通知验证 clsAlipay.key = "" clsAlipay.Notify.partner = "" clsAlipay.Notify.RequestPay() 'clsAlipay.Notify_Verify 通知验证 'clsAlipay.Sign_Verify sign对比验证 If clsAlipay.Notify_Verify and clsAlipay.Sign_Verify Then strNotify = "success" ' Update Database '实物交易根据 clsAlipay.Notify.trade_status 来更新自己的数据 'Response.Write clsAlipay.Notify.trade_status Else strNotify = "fail" End If ' Return Notify Response.Write strNotify ' ShutDown Set clsAlipay = Nothing Set ls = Nothing %>