Rippo
Rippo

Reputation: 22424

IPN response is blank when verifying the IPN

According to this paypal document after we send back the message to Paypal when using a IPN then we get back:-

PayPal will then send one single-word message, VERIFIED, if the message is valid; otherwise, it will send another single-word message, INVALID.

However every now and again I have noticed that the response can be blank even if the payment has been successful. Has anyone else noticed this?

My code to verify is:-

var req = (HttpWebRequest)WebRequest.Create(Settings.PayPalPaymentUrl);

//Set values for the request back
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
byte[] param = Request.BinaryRead(Request.ContentLength);
strRequest = Encoding.ASCII.GetString(param);
strRequest += "&cmd=_notify-validate";
req.ContentLength = strRequest.Length;

//Send the request to PayPal and get the response
var streamOut = new StreamWriter(req.GetRequestStream(), Encoding.ASCII);
streamOut.Write(strRequest);
streamOut.Close();
var streamIn = new StreamReader(req.GetResponse().GetResponseStream());
strResponse = streamIn.ReadToEnd();
streamIn.Close();

99% of the cases I get back VERIFIED but every now and again we are seeing a empty message.

Upvotes: 0

Views: 133

Answers (1)

Adam
Adam

Reputation: 56

You would get a blank response if someone is going to the page directly, instead of being hit from PayPal, is that what's happening?

Upvotes: 1

Related Questions