Notify_url never rings when a buyer pays a subscription

Now I'm trying to make a subscription plan from my site using the paypal sandbox. I already set notify_url in the business account and enabled this feature. refund and cancellation refund work correctly. But when testing with a customer account (personal) and agreeing on a subscription payment, the transaction log is never called to my notify_url site.

My problem is similar to [question]: notify_url not reached or may be a false answer in paypal in the sandbox

Thanks for the help.

+1
source share
1 answer

If you have IPN enabled in your account, log in to your account and see the IPN history. You should be able to tell from here if your IPN is being sent, or if they are in a state of retry or failure. If you see your IPN here, you can click on the message id and it will show you what status your server returns if it saves it. This can help highlight the cause of the problem. In addition, here are some basic troubleshooting steps that can help you with IPN problems.

Also, if you are using a custom script, try using one of the IPN templates for PayPals . These are very simple scripts, but they are verified by working examples. This can help determine if there is a problem with your script or with the IPN in general.

IPN Troubleshooting Tips

These are the most common problems that developers face when working with IPN. The most common solutions are also noted. Hope this info helps someone!

REASONS FOR THE UNbelieving

  • Make sure you publish ALL variables / values.

In order for PayPal to return VERIFIED, your IPN script must return ALL the variables that were sent to it in the first place. In other words, if your script needs to manage only 1 or 2 variables, it is not enough to send back to PayPal only the variables / values ​​that your script is associated with. Your script should post everything that was originally sent to PayPal. This is the only way to return PayPal VERIFIED

  • Make sure you are not sending the wrong URL back.

If you are testing in the Sandbox, you need your script messages to be returned to www.sandbox.paypal.com. If you are on the site in real time, the script should return to the site www.paypal.com. You will receive INVALID if you are testing in the Sandbox and your script messages are sent back to the site (or vice versa)

  • Encoding

The PayPal IPN server expects your script to POST return all the variables that were sent to it, and more importantly, that they are encoded in the same way as they were sent to your script. If your script inadvertently changes the character encoding or interprets the encoded character as a different character and POST, you will most likely see INVALID. This can occur sporadically and tends to occur, for example, when a payment is received, and the buyer may have an accented character in their name or for ordering for any item with a non-standard character in the item name. These instances are difficult to troubleshoot, but they are listed here, as this can cause INVALID when you expect VERIFIED. Look at this problem when you see that some IPNs are INVALID and all others are VERIFIED.

TROUBLESHOOTING TIPS - IPN NOT POSTING!

  • The email address when receiving the account.

Make sure that you have confirmed the email address on the account to which the payment is sent.

  • Access logs

If you think that IPN is not being sent to your script, you can verify this by checking the server access logs. Server access logs will tell you if PayPal "really hits your" w3713 ". The access log keeps track of the IP addresses and / or host names of the computers that access the server. Access to server access logs is possible only to the server administrator. Check them out if you don’t know where the logs are.

  • Error logs Most script languages ​​are displayed in error logs if an error occurs when the script starts. If you see in your access logs that PayPal is sending IPNs but you don’t see the end result from your script, it is likely that you have a logical or syntax error in the script. Check your error logs to check. Again, if you do not know how and where to check these logs, you need to contact your server administrator.

  • Check the way

A simple mistake. Always make sure the path to your script is correct when testing / using IPN, and you see that you are not receiving an IPN message. For example, avoid using the localhost URLs. Since this is setting the server to server server to communicate with the server, the path to the local host will cause IPN to try to send a message to itself, and not outside the network, to your own server / script.

  • Firewalls

IPN is an HTTP POST initiated from PayPal. If your server has a firewall installed, make sure your firewall is not blocking the message from PayPal.

  • Check that your script is working as intended.

If your script has syntax or logic error, chances are you will not see the correct result. An easy way to test your script is to send a “dummy” message to the script and write the code for “do something” if the response from PayPal is INVALID. Essentially, if you copy the code you want to run when the response from PayPal is confirmed by the part of the script that runs if the response is INVALID, you can send fictitious mail to the script to find out if the code is working. Since fictitious mail in the script will return INVALID (since mail was not created from PayPal), that’s why you want to add code to the "if INVALID" part of your script.

  • Messages to your return URL (return method)

Some merchants are configured to receive IPN data sent to the value of their return variable in their button code (return). This is the buyer's URL to which the buyer is directed after PayPal payment. For IPN data to be sent to your return URL, you must set the button code rm to "2", or you may not see any IPN data sent to your return URL. See this post for more information. ** Please note that this IPN data information can be transmitted via return and how it works with your return URL (button code variable "return"). If you have Auto Return with PDT enabled, this information does not apply to you, since PDT is a separate feature. More information on PDT can be found here.

TROUBLESHOOTING TIPS - IPN delayed

In most cases, persistent IPN delays occur when your server does not respond to 200ok for many of your IPN transactions. For example, when your server does not respond with a PayPal attempt, 20,000 attempts to send data. After many data repots that do not receive 200ok, your IPN will go to a slower circular server, hence the delay.

First check your IPN logs for POST status:

In your account in the history section, you should have the "IPN History" section in which you can see IPNs for the last 28 days and in some cases they can resend them. If this link does not appear to enter your account, and not here: https://www.paypal.com/us/cgi-bin/webscr?cmd=_display-ipns-history

These magazines will have several different statuses:

Sent - indicates that PayPal has sent a message to your IPN listener Failed - indicates that PayPal did not receive a confirmation (200ok) to the message for the initial POST attempt or repeated POST Queue - indicates that PayPal is ready to send a message Retry - indicates that PayPal did not receive 200ok, and the message was sent 1 to 15 times in the response and that PayPal continues to resend the message. Disabled - indicates that the message will not be resent because the IPN / Account is disabled.

If you see Failed or Retrying, this is most likely the reason for solving this problem, you will need to go through the logs of your server to determine why 200ok is not sent back to PayNal IPN. After this is determined and fixed, and your server responds with 200ok, this percentage / score is reduced from this limit and it will start sending IPNs from the normal cycle server.

If there are no failures, it may be a delay on the PayPal servers themselves, in which case you will need to create a ticket for PayPal Merchant technical services like paypal.com/mts for further consideration.

Curl vs fsockopen: This is most often a personal preference, but in some cases the provider of the host you are going to does not support one or the other, so you may need to switch between them. The following is an example of using fsockopen:

$header = "POST /cgi-bin/webscr HTTP/1.1\r\n"; $header .= "Host: www.paypal.com\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; $header .= "Content-Length: " . strlen($req) . "\r\n"; $header .= "Connection: Close\r\n\r\n"; $fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30); 

Here is the same, but using curl:

 $url= 'https://www.sandbox.paypal.com/cgi-bin/webscr'; $curl_result=$curl_err=''; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $req); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/x-www-form-urlencoded", "Content-Length: " . strlen($req))); curl_setopt($ch, CURLOPT_HEADER , 0); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_TIMEOUT, 30); $res = @curl_exec($ch); $curl_err = curl_error($ch); curl_close($ch); 

Basically, if you have problems with one, and you think that this may not be one method that is not supported by your host / server, but simply replaces the one that you use with another.

Local testing:
This probably relates to the most important stages of production and testing of any script. As for IPN, this can be used to pass any parameter that your own script requires, to check the syntax and how the script will work with the expected variables. All you really need to do is set up a form with a subsequent action on your own IPN handler and hidden inputs for the variables / values ​​you want to check.

For instance:

 <form target="_new" method="post" action="https://www.YourDomain.com/Path/IPNhandler.php"> <input type="hidden" name="SomePayPalVar" value="SomeValue1"/> <input type="hidden" name="SomeOtherPPVar" value="SomeValue2"/> Than etc for all other variables you want to test with. </br> <input type="submit"/> </form> 

As pointed out in many angel streams, here is a link to a good example of local testing

+5
source

All Articles