snowplow-archive / codeigniter-paypal-ipn

A CodeIgniter library for working with the PayPal IPN (Instant Payment Notification) service

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Response Code Error

brwnll opened this issue · comments

PayPal is telling me that the IPNs are not being received correctly for payment transactions. It seems odd because NONE of the transactions in PayPal's "IPN History" that are the payment type go through. They are all marked as a 500 response code and "retrying".

But ALL transaction types of other types (such as refund) are giving the HTTP 200 response and are marked as "sent".

And finally, even though the "IPN History" shows all payment transactions as 500 codes, all the corresponding orders have been added to my DB correctly.

Any idea what the issue could be?

Would the fact that the order is in the DB cause the library to return a 500 error if PayPal attempts to resend the IPN?

Hi smalldogs - what are you seeing in your ipn_log table - are there any messages of type ERROR in there?

Negative. Of my last 100 rows of ipn_log all are SUCCESS

Weird... Could your IPN CodeIgniter controller be doing something to cause an error after the codeigniter-paypal-ipn code has run? What return code do you see in your browser (use Chrome Developer Tools) when you replay a 500ed order directly in your browser?

There was an error in my codeigniter mail sending, resulting in all validations and db calls to be executed as expected, but still give PayPal a 500 response because of the email error.

Okay cool - thanks for letting me know!

I ran into the same issue, I would suggest a code change to have the mailing (smarty) DISABLED by default, and let the user enable their method of notification (in my case I use an internal app method via the DB to notify, no need for emails)

Thanks Don for your comment and pull request. The example controller was originally meant just to give a flavour of how an IPN response can be handled (I don't view it as part of the library itself), but it looks like people are using it rote and then coming a cropper.

The trouble with commenting out the emailing is that I know people will then start running into the opposite problem: i.e. they will deploy the example controller without checking it, and then wonder why they are not receiving any notifications about their orders. To get around this, I'm going to split example.php into example-no-notification.php and example-smarty-email-notification.php. Then it should be pretty error proof and people can choose which example they want...

@alexanderdean makes sense, thanks :)
I was one of those few that didn't need the notification as an email, added my own piece but totally forgot about the email, I commented out the 'sending', as I was working quick to add paypal functionality.

My sandbox tests worked, so I proceeded to production where I kept getting good responses by paypal was getting ipn failures. So I realized then this was the cause after further review.

Thanks @donjakobo - I'm sorry you got caught by that, thanks for bringing it to my attention so we can stop other people getting caught out too! I've made the split of example.php now and updated the README too - if you spot anything else, feel free to do another pull request...

@alexanderdean thanks for the quick response. No worries, getting caught on this thing was my own doing as I rushed what I needed to do. If it wasn't for you guys I wouldn't even have had a library to utilize so I'm far better off! Thanks!

No worries - glad it's useful!