Paypal IPN not calling Issue

后端 未结 1 668
失恋的感觉
失恋的感觉 2021-02-11 01:20

I am having some problem regarding Paypal IPN not getting fired on one of my server. Below is the scenario.

1) I have two sites site A(old) is on server X and site B(ne

1条回答
  •  [愿得一人]
    2021-02-11 02:02

    Unfortunately, there's not much issue specific information for me to work with, so lets make this an IPN Troubleshooting Guide for future reference :)

    Check the IPN feature status for the given account -

    https://www.paypal.com/cgi-bin/customerprofileweb?cmd=_profile-ipn-notify (login to your account first, then follow the link to be taken to the IPN Settings)

    Alternative:

    • Login to PayPal.com
    • Open Profile --> My Selling Preferences
    • Find the "Instant payment notifications" option

    There are four states IPN can be in:

    • Enabled --> If you're prompted to choose your settings, IPN is enabled and IPNs will be sent if a notify URL is passed in the checkout request.

    • Enabled with Default URL Set --> If a "Notification URL" is displayed and "Message delivery" is set to enabled, the default URL will be used every time you do not specify a different IPN URL in the checkout request (e.g. eBay transactions will be sent to the default URL because eBay's Express Checkout Integration does not pass a notify URL)

    • Disabled --> You never set the default URL, but IPN URL passed in your transactions has been throwing too many errors. You should see the empty Address field and the option "Do not receive IPN messages (Disabled)" being checked.

    • Disabled with Default URL Set --> a default IPN URL was configured at some point in time, but due to failures on the default URL or on the dynamic URLs, the IPN feature has been disabled. You will see the URL and "Message Delivery = Disabled"

    Why does PayPal disable IPN delivery?

    PayPal expects your server to respond with a HTTP-200 OK message. If we receive a different response code, a retry mechanism is set in motion. The IPN message is sent a total of 16 times with increasing time frames between each attempt. If the errors for one URL reach a certain threshold, IPN is disabled automatically. You will receive an e-mail message to the main e-mail address listed on the PayPal Account, that warns you of an impending deactivation

    1. If IPN is enabled, check the status of the last IPN messages under https://www.paypal.com/cgi-bin/webscr?cmd=%5fdisplay%2dipns%2dhistory&nav=0%2e3%2e4

      It'll show you the last HTTP Response Codes your server is sending back and you can filter for failed / retrying messages.

      Check http://en.wikipedia.org/wiki/List_of_HTTP_status_codes to see what the status means.

    2. If there is not HTTP Response code, there's a connection issue on a lower level. Most frequently caused by:

      • Firewalls
      • SSL Connectivity Problems (try using HTTP)
      • Black Hole Routing

      If you feel that everything is configured correctly, check out https://ppmts.custhelp.com/app/answers/detail/a_id/733

    3. If the IPN messages are marked as "SENT" (HTTP 200 Received), the next step in IPN processing is posting the data back to PayPal for validation. You can either enable logging within the script (dump the HTTP request and response in a file on the server) - or you can contact PayPal MTS ( https://www.paypal.com/mts ) and ask what's visible on the PayPal Side.

      A good test to check the connectivity to paypal is to run the following command on the webserver itself:

      curl -d "cmd=_notify-validate" -v https://www.paypal.com/cgi-bin/webscr

    4. If you see that the POST has reached PayPal, but PayPal responds with INVALID for all messages:

      Check your code, https://github.com/paypal/ipn-code-samples is a good source of samples

    5. If PayPal responds with INVALID to some messages, you're likely running into an encoding issue. You'd best set your Character Encoding settings under https://www.paypal.com/cgi-bin/customerprofileweb?cmd=_profile-language-encoding - set them to UTF8 for the best results.

    6. If PayPal Responds with VERIFIED, but your script doesn't continue processing after validating the payment, make sure you run a TRIM() (or the equivalents in the language being used) to remove whitespace, line feeds and CRLF

    7. What happens afterwards is up to the IPN script you may run into errors while connecting to a database, parsing the IPN message for certain data or some coding errors.

    In short: If the IPN message has been received, posted back and verified, everything else happens in your own code on your server and you'd have to start digging through log files (or make sure logs are being created, that's always a good idea) to find out what's going on. If the problem is reproducible, it is always a good idea to check what happens with one of the sample scripts (which include logging)

    Hope this helps tackling IPN issues head on - any questions regarding IPN? Contact paypal.com/mts if you want to investigate what's happening on the paypal side.

    0 讨论(0)
提交回复
热议问题