One of my clients ran into a problem with their Google Analytics logging system. There was a Perl script set up by another developer to receive Paypal Payment Data Transfer (PDT) notifications each time a user was billed. This script would then send a notification to the Analytics tracker to log the successful payment. One day, it just stopped working.
Handling asynchronous requests can be a bit of a nightmare. If you miss the callback and you don’t have some sort of logging system set up, that data can just disappear. Also, if you’re not printing things like “PAYPAL ERROR 500 OMG” to the user (and it’s arguably best not to!), you’ll never know it’s happening until you notice a few weeks later that no more data is being tracked.
We set up some basic logging in the script to take note of what Paypal was telling us.
An Error Occurred: 500 Can’t verify SSL peers without knowning which Certificate Authorities to trust
That’s actually a verbatim error too, so the typo isn’t ours. It turns out that one of the dependencies in the Perl script had been updated, and that the certificates were no longer valid.
http://cpansearch.perl.org/src/GAAS/libwww-perl-6.00/Changes
For us, the fix included adding the following two lines to the top of the file:
use IO::Socket::SSL;
use Mozilla::CA;
Additionally, we had to install these libraries to a specific location and to specify to our Perl script that the libraries were there. On Hostgator, we went into the cPanel and installed Mozilla::CA and IO::Socket::SSL, and added the following lines to our script (directory name removed):
BEGIN {
my $base_module_dir = (-d ‘/home/USER_NAME/perl’ ? ‘/home/USER_NAME/perl’ : ( getpwuid($>) )[7] . ‘/perl/’);
unshift @INC, map { $base_module_dir . $_ } @INC;
}
If you’re seeing Error 500 in your Paypal PDT scripts, give this a shot. And if you think this is happening to you and you need someone to patch it, feel free to contact me!