PayPal IPN侦听器保留“正在重试” HTTP响应500

问题描述 投票:0回答:1

我的IPN侦听器在过去6个月中一直运行良好。但是在上周,所有事务都在“重试”并导致HTTP 500响应。我没有在IPN侦听器中更改任何代码,也没有在PayPal中更改任何设置。我给PayPal打电话了,他们说这不是他们的结局。我的托管公司1&1 Ionos几乎不知道我在说什么。我的IPN侦听器代码如下。我的网站使用Asp.Net/VB.Net ..

Imports System.Net
Imports System.IO
Imports System.Web.Util
Imports System.Data.Common

Partial Class IPNListener
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        'Post back to either sandbox or live
        'Dim strURL As String = "https://www.sandbox.paypal.com/cgi-bin/webscr"
        Dim strURL As String = "https://www.paypal.com/cgi-bin/webscr"
        Dim req As HttpWebRequest = CType(WebRequest.Create(strURL), HttpWebRequest)

        'Set values for the request back
        req.Method = "POST"
        req.ContentType = "application/x-www-form-urlencoded"
        req.Proxy = New WebProxy("ntproxyus.lxa.perfora.net", 3128)

        Dim Param() As Byte = Request.BinaryRead(HttpContext.Current.Request.ContentLength)
        Dim strRequest As String = Encoding.ASCII.GetString(Param)
        strRequest = strRequest + "&cmd=_notify-validate"
        req.ContentLength = strRequest.Length

        'Send the request to PayPal and get the response
        Dim streamOut As StreamWriter = New StreamWriter(req.GetRequestStream(), Encoding.ASCII)
        streamOut.Write(strRequest)
        streamOut.Close()
        Dim streamIn As StreamReader = New StreamReader(req.GetResponse().GetResponseStream())
        Dim strResponse As String = streamIn.ReadToEnd()
        streamIn.Close()

        Dim qscoll As NameValueCollection = HttpUtility.ParseQueryString(strRequest)

        'Insert the paypal response
        Dim order As New orders
        order.InsertPaypalResponse(qscoll("txn_id"), qscoll("custom"), strRequest)

        If strResponse = "VERIFIED" Then
              order.UpdateOrderFromPaypal(qscoll("custom"), qscoll("txn_id"), qscoll("payment_status"))
        ElseIf strResponse = "INVALID" Then
            'log for manual investigation
            order.UpdateOrderFromPaypal(qscoll("custom"), qscoll("txn_id"), qscoll("payment_status"))
        Else
            'Response wasn't VERIFIED or INVALID, log for manual investigation
            order.UpdateOrderFromPaypal(qscoll("custom"), qscoll("txn_id"), qscoll("payment_status"))
        End If
    End Sub
End Class
asp.net vb.net paypal-ipn
1个回答
0
投票

您的IPN侦听器可能无法连接到https://www.paypal.com/cgi-bin/webscr以验证其接收到的IPN,因此拒绝处理IPN并返回HTTP 500,从而使PayPal反复重试其传递。

为了使您的监听器能够连接到PayPal并验证IPN,您需要确保您拥有更新的证书颁发机构捆绑包/列表,该列表/列表能够验证PayPal服务器当前的加密安全SSL证书的颁发者。

同时,请更新IPN侦听器以使用ipnpb.paypal.com而不是www.paypal.com。请参阅当前文档:https://developer.paypal.com/docs/ipn/integration-guide/IPNImplementation/

© www.soinside.com 2019 - 2024. All rights reserved.