Click here to Skip to main content
15,886,258 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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...
Posted

1 solution

 
Share this answer
 
Comments
Member 10993104 15-Oct-14 12:36pm    
Ok. Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900