{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