您好,登录后才能下订单哦!
小编给大家分享一下如何修改VB.NET支付宝接口,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!
曾经为没有VB.NET支付宝接口程序郁闷过很长一段时间,终于忍不住修改了一下,其主要的3个文件修改为VB.NET很容易,不再给出,只给出接口代码:
Private Sub ImageButton1_Click(ByVal sender As System.Object,
ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click'按时构造订单号
Dim currentTime As System.DateTime = New System.DateTime
currentTime = System.DateTime.Now
Dim out_trade_no As String
out_trade_no = currentTime.ToString("g")
out_trade_noout_trade_no = out_trade_no.Replace("-", "")
out_trade_noout_trade_no = out_trade_no.Replace(":", "")
out_trade_noout_trade_no = out_trade_no.Replace(" ", "")
'业务参数赋值
Dim gateway As String = "https://www.alipay.com/cooperate/gateway.do?" '支付接口
Dim service As String = "trade_create_by_buyer"'服务参数
Dim sign_type As String = "MD5"
Dim subject, body As String
body = ""
sql = "select cp_name from chanpin where cp_id="& cint(label2.text)
getdata.myconn.Open()
reader = getdata.getdatareader(sql)
While reader.Read
subject = reader.Item(0)'商品名称
bodybody = body & " " & reader.Item(0)'商品描述 ,不能有太多字符
End While
reader.Close()
Dim quantity As String
quantity = "1" '商品数量
Dim payment_type As String
payment_type = "1"
'支付类型'1=商品购买,2=服务购买,3=网络拍卖,4=捐赠,5=邮费补偿,6=奖金
Dim price As String
sql = "select cp_money from chanpin where cp_id="& cint(label1.text)
reader = getdata.getdatareader(sql)
If reader.Read Then
price = reader.Item(0)'商品价格
End If
reader.Close()
Dim show_url, seller_email, key, partner As String
show_url = "http://****"'商品描述地址
seller_email = *** '您的支付宝认证Email,必须通过支付宝认证才可以
key = ***'安全校验码,在支付宝网站“商家工具”那里可以获得
partner = ***'partner合作伙伴ID
Dim return_url As String ="Alipay_Return.aspx" '服务器通知返回接口
Dim notify_url As String ="Alipay_Notify.aspx" '服务器通知接口
Dim _input_charset As String = "utf-8" '服务器编码
Dim logistics_type As String = "POST"
Dim logistics_fee As String = "0" '平邮费包含在价格中
Dim logistics_fee_1 As String = "0"'快递费 包含在价格中
Dim logistics_payment As String = "BUYER_PAY"
Dim logistics_type_1 As String = "EXPRESS"
Dim logistics_payment_1 As String = "BUYER_PAY"
Dim ap As AliPay = New AliPay
Dim aliay_url As String = ap.CreatUrl(gateway, service, partner, sign_type,
out_trade_no, subject, body, payment_type, price, show_url, seller_email, key,
return_url, _input_charset, notify_url, logistics_type, logistics_fee,
logistics_payment, logistics_type_1, logistics_fee_1, logistics_payment_1, quantity)Response.Redirect(aliay_url)
End Sub
以上是“如何修改VB.NET支付宝接口”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注亿速云行业资讯频道!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。