PayPal Instant Payment Notification (IPN) Issue: PayPal sends VERIFIED response but has FAILED status in IPN History. 404 Error - paypal

PayPal is sending the VERIFIED message to my IPN listener but my IPN History shows a FAILED status. The IPN History also shows a 404 error. The code I am using for my listener can be found here: https://cms.paypal.com/cms_content/US/en_US/files/developer/IPN_PHP_41.txt. I am testing this with sandbox. How can I be receiving a VERIFIED response from Paypal but yet the IPN History shows a failed STATUS with a 404 error? Shouldn't PayPal be sending an INVALID response since the IPN History status is failed?

VERIFIED has nothing to do with how the transactions appear in your ipn history. How you respond to the original ipn post is what determines what shows in your ipn history.
If your ipn history says it's receiving a 404 response, then you need to check your ipn script and stop sending a 404 response.
If it were any other error, since you are using PayPal's script, I would bet you didn't change the environment variable/the URLs to match your environments. With a 404 though, you're telling the client (paypal in this case) that the page they want doesn't exist, even if you're still reading the data

Related

PayPal IPN Processing

I have implemented an IPN listener in VBScript/Classic ASP.
From my side, it seems to work perfectly.
When it is called, it sends the message back to Paypal appending cmd=_notify-validate. It then checks the response for objHttp.status = 200 and objHttp.responseText = "VERIFIED" then adds the order to my database.
However Paypal are sending me emails;
Subject: PayPal Instant Payment Notification Warning
Instant Payment Notifications sent to the following URL(s) are failing:
According to IPN Testing
Every listener must include code that handles the "error notification" IPN messages.
Either way you should follow the steps in the IPN troubleshooting tips step by step.
Here is a few I've picked out that should help.
Check the URLs listed in your IPN history to ensure that PayPal is posting each IPN to your listener.
Check your web server's access and error logs.
Check your programming language's error log.
Verify that your IPN listener is responding to all messages, even those you do not intend to process.
Further to the OPs comments
the code samples Paypal give, in which this step isn't performed. Is this step required?
it sounds like you are missing Step 2 from the workflow in the documentation
2. After receiving the IPN message from PayPal, your listener returns an empty HTTP 200 response to PayPal. Otherwise, PayPal resends the IPN message.
Judging by the PHP sample as well both seem to send the verification first, which doesn't tally with the workflow suggested by the documentation.
In which case you should just be able to do
Response.Status = "200 OK"
after the rest of the code, make sure nothing else is written back using Response.Write() so the server response is blank, you could even use
Call Response.Clear()
before setting the Response.Status to make sure nothing else has been written from the Response buffer. This will only work however if Response.Buffer has been set to True beforehand (usually at the beginning of the script).

Is there an IPN sent after DoExpressCheckoutPayment?

After we do DoExpressCheckoutPayment - resulting in payment status Completed or failing with some other status - is there any IPN sent from PayPal?
Yes, DECP sends IPN notifications. If you're not getting them make sure you have IPN enabled either through your profile or by the NOTIFYURL parameter in your request. Then check the IPN History in your PayPal account and your web server logs for details on whether or not the script is getting hit or not, and if there might be an error keeping it from running correctly.

PayPal IPN simulator - how to generate INVALID response?

I'm using Paypal IPN simulator to test changes. I'm trying to generate an INVALID response.
I select
Transaction type: Cart Checkout
payment_status: Denied, Failed or Expired.
However all of these generate a notification call with response VERIFIED
update didn't read close enough. Documentation says: PayPal sends a single word back, which is either VERIFIED if the message originated with PayPal or INVALID if there is any discrepancy with what was originally sent. So if I just browse to my IPN URL directly, I will get an INVALID response from Paypal because the call to IPN did not originate with PayPal.
Regarding your update: close, but not exactly.
IPN will return VERIFIED or INVALID depending on whether or not it recognizes the POST data you're sending as having originated from PayPal.
So yes, if you browse to your IPN URL directly and it directly POST's no data / dummy data to PayPal, then yes, we won't recognize it as having originated from us and we'll return INVALID.
For example, this link will return INVALID:
https://www.paypal.com/cgi-bin/webscr?cmd=_notify-validate&dummy_data=true

Cubecart and Paypal IPN

We seem to be having an issue with a customer who has a cubecart store and Paypal IPN. The issue is that the IPN notification URL's were working and changing the order status upon a successful purchase, but now it seems to have stopped working. The orders go through ok and the item appears in the Paypal account, but it is not updating the order status on the store (goes from pending to processing automatically).
Check your IPN history in your account. First verify that the IPN is being sent out. If the IPN log shows the IPN being sent out, see if it is in a failed or retrying status. Also look at the details of the IPN message and see if it shows the status code that is being returned back from your site. The IPN system expects a 200ok response to be returned. If there is a different status code, this may help to determine the cause of the issue. Also, double check with your hosting provider if hosting with a 3rd party to make sure they haven't done any updates to firewalls or proxy's that may have affected your script.

PHP paypal sandbox

I am using paypal sandbox for my transactions but ipn is not working. When i check ipn history in my sandbox account it often shows the status as "Retrying". Sometimes it show the status as "Failed".
When i try to resend the ipn again from the account it is successfully sent.
Can any one guide me in understanding why it sometimes fails and what the reason(s) could be?...
No, we can't.
When it's 'Retrying' it means it did not get a proper HTTP/1.1 200 OK response from your script.
Most likely, this means it errorred out when attempting to POST data to it.
If you click on the 'Message ID' in the IPN history, you can view the HTTP status it encountered when accessing the script.
Once you've narrowed it down to a specific HTTP error code, you'd want to review your webserver access and error logs to find the cause of the error.
Thanks for your response.
My problem has been resolved. The return url was incorrect, and that's why ipn was not working.
My return url was correct in the paypal account and that is why ipn was working from the account.