{Following is the vb.net code for IPN listener:
If Me.TestMode = True Then
Me.RequestUrl = "https://www.sandbox.paypal.com/cgi-bin/webscr"
Else
Me.RequestUrl = "https://www.sandbox.paypal.com/cgi-bin/webscr" '"https://www.paypal.com/cgi-bin/webscr"
End If
'====================================Test======================================'
Dim startTime As String = String.Format("{0:MM-dd-yyyy hh:mm:ss:tt}", Now)
'=============================================================================='
Dim req As HttpWebRequest = CType(WebRequest.Create(Me.RequestUrl), HttpWebRequest)
req.Method = "POST"
req.ContentType = "application/x-www-form-urlencoded"
Dim Param() As Byte = HttpContext.Current.Request.BinaryRead(HttpContext.Current.Request.ContentLength)
Dim strRequest As String = Encoding.ASCII.GetString(Param)
strRequest = strRequest & "&cmd=_notify-validate"
req.ContentLength = strRequest.Length
' Dim pairs() As String = strRecieved.Split("&")
Using streamOut As StreamWriter = New StreamWriter(req.GetRequestStream(), Encoding.ASCII)
streamOut.Write(strRequest.ToString)
streamOut.Close()
End Using
Dim streamIn As StreamReader = New StreamReader(req.GetResponse().GetResponseStream())
Dim strResponse As String = streamIn.ReadToEnd()
streamIn.Close()
WriteLog(strResponse)
我已经在vb.net中完成paypal IPN监听器的代码。当我使用PayPal沙箱帐户测试该网址时,会显示以下消息: “IPN已成功发送。” 但是,当我检查我的日志文件在服务器上,然后显示INVALID从贝宝沙箱网址的响应。没有VALID回应我的其他代码将无法正常工作。 请帮忙!!Paypal IPN返回INVALID响应
当PayPal交易发生任何事件时发送IPN消息。 IPN消息如何以及在哪里出现“IPN成功发送”。 – irfanmcsd 2012-04-14 03:55:22
当我用贝宝沙箱模拟器测试它。那时我正在收到“IPN成功发送”的消息。 – 2012-04-14 04:08:31
在PayPal沙盒上做一次测试交易,这样PayPal会发送给您有效状态的ipn响应。 – irfanmcsd 2012-04-14 04:46:40