支付宝借口参数vb.net版
注意编码为utf-8
'按时构造订单号
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_no = out_trade_no.Replace("-", "")
out_trade_no = out_trade_no.Replace(":", "")
out_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 As String="商品名"
Dim body As String="商品描述"
Dim quantity As String="商品数量" '参数必须为数字
Dim payment_type As String = "支付类型" '1=商品购买,2=服务购买,3=网络拍卖,4=捐赠,5=邮费补偿,6=奖金,,,我就是这里出错,自己以为支付类型,写个支付宝支付,结果问题大条
Dim price As String= "商品价格" '参数必须为数字
Dim show_url As String="http://*****" '商品描述地址
Dim seller_email As String="**@**.**" '支付宝认证Email,必须通过支付宝认证才可以
Dim key As String="***" '安全校验码,在支付宝网站“商家工具”那里可以获得
Dim partner As String="" 'partner合作伙伴ID
Dim return_url As String = show_url & "/Alipay_Return.aspx" '服务器通知返回接口
Dim notify_url As String = show_url & "/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)
'按时构造订单号
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_no = out_trade_no.Replace("-", "")
out_trade_no = out_trade_no.Replace(":", "")
out_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 As String="商品名"
Dim body As String="商品描述"
Dim quantity As String="商品数量" '参数必须为数字
Dim payment_type As String = "支付类型" '1=商品购买,2=服务购买,3=网络拍卖,4=捐赠,5=邮费补偿,6=奖金,,,我就是这里出错,自己以为支付类型,写个支付宝支付,结果问题大条
Dim price As String= "商品价格" '参数必须为数字
Dim show_url As String="http://*****" '商品描述地址
Dim seller_email As String="**@**.**" '支付宝认证Email,必须通过支付宝认证才可以
Dim key As String="***" '安全校验码,在支付宝网站“商家工具”那里可以获得
Dim partner As String="" 'partner合作伙伴ID
Dim return_url As String = show_url & "/Alipay_Return.aspx" '服务器通知返回接口
Dim notify_url As String = show_url & "/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)