Dim auth_code As String = args(0) '扫描枪扫码后获取的授权码
Dim productId As String = args(1) '订单ID
Dim total_fee As Integer = args(2) '支付金额
Dim client As Aop.Api.IAopClient = New Aop.Api.DefaultAopClient(Vars("alipay_url"),Vars("alipay_addid"),Vars("alipay_private key"), "json", "1.0", "RSA2",Vars("alipay_public key"), "GBK", False)
Dim tn As String = "MICROPAY"
Dim req As WxPayData = Functions.Execute("GetWxPayData")
Dim dr As DataRow = DataTables(tn).Find("product_id='" & productId & "'")
Dim out_trade_no As String = req.GenerateOutTradeNo()
Dim scene As String = "bar_code"
Dim subject As String = "Smile邻间线下支付"
Dim total_amount As Double = total_fee/100
Dim body As String ="欢迎光临"
Dim store_id As String = "天行超市"
dr("out_trade_no") = out_trade_no
dr("total_fee") = total_fee
Dim request As Aop.Api.Request.AlipayTradePayRequest = New Aop.Api.Request.AlipayTradePayRequest()
Dim jo As New JObject
jo("out_trade_no") = req.GenerateOutTradeNo()
jo("scene") = "bar_code"
jo("auth_code") = auth_code
jo("subject") = subject
jo("total_amount") = "0.50"
jo("body") = body
jo("store_id") = store_id
request.BizContent = jo.ToString
Dim response As Aop.Api.Response.AlipayTradePayResponse = client.execute(request)
MessageBox.Show(response.ReceiptAmount)