Problem Overview:
I have implemented an IPN listener and I know that PayPal routes it (due to the generated text file), the correct parameters are sent to me in QueryString, however, when I add "& cmd = notify-validate" to the query string for verification and send it in PayPal, I get the following HTML response:
.
When I copy and paste the resulting HTML into an empty HTML document, I see the following: 
Initially, I thought my session was expired, but when I accessed Sandbox through my browser, I was automatically logged in. I even tried clicking the link in my html document to make sure I was logged in and tried to process another test IPN through a simulator in the sandbox, but I continue to get this result. I just donโt see what I am doing wrong, and itโs sad that it worked correctly about an hour ago :(
My IPN listener code to send and receive a validation response:
Dim payPalUrl As String = PayPalPayment.PayPalURL 'This returns https://www.sandbox.paypal.com/cgi-bin/webscr Dim req As HttpWebRequest = CType(WebRequest.Create(payPalUrl), HttpWebRequest) 'Set values for the request back req.Method = "POST" req.ContentType = "application/x-www-form-urlencoded" Dim params() As Byte = Request.BinaryRead(Request.ContentLength) Dim ipnRequest As String = Encoding.ASCII.GetString(params) Dim ipnPost As String = ipnRequest ipnRequest &= "&cmd=notify-validate" req.ContentLength = ipnRequest.Length myUtility.AuditIPN(filename, ipnRequest) ''for proxy 'Dim proxy As New WebProxy(New System.Uri("http://url:port#")) 'req.Proxy = proxy 'Send the request to PayPal and get the response Dim streamOut As New StreamWriter(req.GetRequestStream(), Encoding.ASCII) streamOut.Write(ipnRequest) streamOut.Close() Dim streamIn As New StreamReader(req.GetResponse().GetResponseStream()) Dim ipnResponse = streamIn.ReadToEnd() streamIn.Close() 'Rest of the code here... not necessary for this problem
Posting a payment to PayPal (if necessary). NOTE. I am creating a form and Response.Write () on the page. This is form generation:
Dim form As New StringBuilder form.AppendLine("<!DOCTYPE html>") form.AppendLine("<html xmlns=""http://www.w3.org/1999/xhtml"">") form.AppendLine("<head runat=""server"">") form.AppendLine(String.Format("<title>{0} {1}</title>", "PayPal payment for", ItemName)) form.AppendLine("<link href=""../css/paypal.css"" rel=""stylesheet"" />") form.AppendLine("</head>") form.AppendLine("<body>") form.AppendLine("<div class=""paypal""></div>") form.AppendLine(String.Format("<p>Accessing PayPal to process your payment for the {0}.</p>", ItemName)) form.AppendLine("<div class=""loading""></div>") form.AppendLine("<form id=""myform"" action=""https://www.sandbox.paypal.com/cgi-bin/webscr"" method=""post"">") form.AppendLine("<input type=""hidden"" name=""cmd"" value=""_xclick"">") form.AppendLine(String.Format("<input type=""hidden"" name=""business"" value=""{0}"">", BusinessEmail)) form.AppendLine(String.Format("<input type=""hidden"" name=""item_name"" value=""{0}"">", ItemName)) form.AppendLine(String.Format("<input type=""hidden"" name=""amount"" value=""{0}"">", Amount)) form.AppendLine(String.Format("<input type=""hidden"" name=""currency_code"" value=""{0}"">", Currency)) form.AppendLine(String.Format("<input type=""hidden"" name=""return"" value=""{0}"">", ReturnURL)) form.AppendLine("<input type=""hidden"" name=""button_subtype"" value=""products"">") form.AppendLine("<input type=""hidden"" name=""bn"" value=""HHMRKWQT8NRTW:PP-BuyNowBF_P"">") form.AppendLine("<input type=""hidden"" name=""no_note"" value=""0"">") form.AppendLine("</form>") form.AppendLine("<script type=""text/javascript"">") form.AppendLine(" document.forms[""myform""].submit();") form.AppendLine("</script>") return form.ToString()
If I need to post anything else on this issue, let me know, as my brain is now completely fried.
Your time and help will be greatly appreciated!
NOTE. Although my code is in VB.NET, I am also developing in C #, so the C # example code will definitely not frown!
Answer:
If you receive HTML in return, then the notification confirmation is not checked correctly in PayPal. It should be & cmd = _notify-validate (with an underscore immediately after the cmd key), I must somehow remove it in my foggy numbness. My IPN listener now successfully returns VERIFIED :)