问题描述
我有一个用VB.net编写的Web应用程序。我通过paypal实现了付款。当我通过电脑付款时没有问题,但是当我通过手机付款时,我遇到了一些问题。我无法在返回页面上阅读paypal参数。(我正在使用IPN)我使用httpwebrequest从paypal读取信息,但变量request.form为空,因此响应为INVALID。
低于我的代码:
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
'将请求发送到PayPal并获取响应
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()
如果myHttpWebResponse.StatusCode<> HttpStatusCode.OK然后
否则
结束如果
有谁可以帮助我???请...
I have a web application written in VB.net. I implemented the payment via paypal. When I make a payment via pc there is no problem, but when I make a payment via mobile I have some problems. I can't read the paypal parameters on my return page.(i'm using IPN) I used httpwebrequest for read the info from paypal, but the variables request.form is empty, so the response is "INVALID".
Below my code:
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
is there anyone who can help me??? please...
推荐答案
这篇关于PayPal POST付款不适用于移动浏览器Pin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!