您好,登錄后才能下訂單哦!
小編給大家分享一下如何修改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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。