zoukankan      html  css  js  c++  java
  • 财付通接口(asp)

    转自:http://blog.bandao.cn/archive/39296/blogs-356873.aspx 

    '============ 财付通接口开始 ====================
            sDate     = Now()'生成订单编号,建议使用您网站自己系统的订单编号,否则可用日期时间的方式生成唯一订单编号
            sDate     = Year(sDate) & Right(("00" & Month(sDate)),2) & Right(("00" & Day(sDate)),2) & Right(("00" & Hour(sDate)),2) & Right(("00" & Minute(sDate)),2) & Right(("00" & Second(sDate)),2)
           
            inBillNo = billno
           
            spid   = "1201667801"   ' 这里替换为您的实际商户号
            sp_key = "7491a6abe13df8940108438af524484b" ' sp_key是32位商户密钥, 请替换为您的实际密钥
          
            ' 下面是请求参数
            cmdno   = "1"     ' 财付通支付为"1" (当前只支持 cmdno=1)
            bill_date = Left(sDate,8) ' 交易日期 (yyyymmdd)
            bank_type = "0"     ' 银行类型: 0   财付通
                    '    1001 招商银行  
                    '    1002 中国工商银行
                    '    1003 中国建设银行
                    '    1004 上海浦东发展银行  
                    '    1005 中国农业银行
                    '    1006 中国民生银行
                    '    1008 深圳发展银行  
                    '    1009 兴业银行  
          
            desc   = order_info_no & "号订单("&order_info_RealName&")在线支付"   ' 商品名称
            purchaser_id = ""     ' 用户QQ号码, 现在置为空串, 如果选择银行网关支付, 需要指定一个QQ号
            bargainor_id = spid     ' 商户号
            sp_billno = inBillNo   ' 商户生成的订单号(最多32位)
          
            ' 重要:
            ' 交易单号(28位): 商户号(10位) 日期(8位) 流水号(10位), 必须按此格式生成, 且不能重复
            ' 如果sp_billno超过10位, 则截取其中的流水号部分加到transaction_id后部(不足10位左补0)
            ' 如果sp_billno不足10位, 则左补0, 加到transaction_id后部
            transaction_id = spid & bill_date & Right(sDate,10)
          
            total_fee = order_info_AllCost     ' 总金额, 分为单位
            total_fee = total_fee*100
            fee_type = "1"     ' 货币类型: 1 – RMB(人民币) 2 - USD(美元) 3 - HKD(港币)
            return_url = "http://www.cqltt.com/tenpay/notify_handler2.asp" ' 财付通回调页面地址, 推荐使用ip地址的方式(最长255个字符)
            attach   = inBillNo ' 商户私有数据, 请求回调页面时原样返回
          
            ' 生成MD5签名   
            sign_text = "cmdno=" & cmdno & "&date=" & bill_date & "&bargainor_id=" & bargainor_id &_
                "&transaction_id=" & transaction_id & "&sp_billno=" & sp_billno &_
                "&total_fee=" & total_fee & "&fee_type=" & fee_type & "&return_url=" & return_url &_
                "&attach=" & attach & "&key=" & sp_key
          
            md5_sign = UCase(ASP_MD5(sign_text))        ' 转换为大写
           
            ok_url = "http://portal.tenpay.com/cfbiportal/cgi-bin/cfbiin.cgi?" &_
             "cmdno=" & cmdno & "&date=" & bill_date & "&bank_type=" & bank_type & "&desc=" & desc &_
             "&purchaser_id=" & purchaser_id & "&bargainor_id=" & bargainor_id &_
                "&transaction_id=" & transaction_id & "&sp_billno=" & sp_billno &_
                "&total_fee=" & total_fee & "&fee_type=" & fee_type & "&return_url=" & return_url &_
                "&attach=" & attach & "&sign=" & md5_sign
               
          
           response.redirect (ok_url)
            '============ 财付通接口结束 ====================

  • 相关阅读:
    SpringMVC截图版
    MySQL
    Mybatis-Spring
    Spring
    get
    log
    SpringBoot
    Mybatis和spingboot整合
    学习笔记-英语
    PartialView+$.reload()局部刷新
  • 原文地址:https://www.cnblogs.com/millen/p/1680666.html
Copyright © 2011-2022 走看看