【问题标题】:PayPal POST payment not working on mobile browsersPayPal POST 付款无法在移动浏览器上运行
【发布时间】:2014-12-05 21:23:14
【问题描述】:
我有一个用 VB.net 编写的 Web 应用程序。我通过贝宝实施付款。
电脑支付是没问题的,但是手机支付就有点问题了。
我无法读取退货页面上的贝宝参数。
我使用 httpwebrequest 从 paypal 读取信息,但变量 request.form 为空,因此响应为“INVALID”。
有没有人可以帮帮我???请...
【问题讨论】:
标签:
vb.net
paypal
paypal-sandbox
【解决方案1】:
这是我的代码:
Dim objHttp As HttpWebRequest
objHttp = WebRequest.Create("https://www.sandbox.paypal.com/cgi-bin/webscr")
objHttp.Method = "POST"
objHttp.ContentType = "application/x-www-form-urlencoded"
Dim param As Byte() = Request.BinaryRead(HttpContext.Current.Request.ContentLength)
Dim strRequest As String = Encoding.ASCII.GetString(param)
Dim ipnPost As String = strRequest
strRequest += "&cmd=_notify-validate"
objHttp.ContentLength = strRequest.Length
'Send the request to PayPal and get the response
Dim streamOut As New StreamWriter(objHttp.GetRequestStream(), System.Text.Encoding.ASCII)
streamOut.Write(strRequest)
streamOut.Close()
Dim streamIn As New StreamReader(objHttp.GetResponse().GetResponseStream())
Dim strResponse As String = streamIn.ReadToEnd()
streamIn.Close()
Dim myHttpWebResponse As HttpWebResponse = CType(objHttp.GetResponse(), HttpWebResponse)
Dim strIdTransazione = Request.Form("txn_id")
Dim strDscTransazione = Request.Form("payment_status")
'HttpStatusCode.myHttpWebResponse.StatusCode()
If myHttpWebResponse.StatusCode <> HttpStatusCode.OK Then
Else
end if