ClickBank is generous to provide code examples for many implementations of their Instant Notification Service, but… they don’t include Perl for some reason.
Here’s my Perl implementation.
use CGI; use Digest::SHA1 qw(sha1_hex); use Encode; $q = new CGI; sub ipnVerification() { my $secretkey = 'YOUR SECRET KEY'; my $pop = ""; foreach $field (sort($q->param)) { unless ($field eq "cverify") { $pop .= $q->param($field) . "|"; } } $pop .= $secretkey; my $calcedVerify = sha1_hex(encode("utf8", $pop)); $calcedVerify = uc(substr($calcedVerify,0,8)); return ($calcedVerify eq $q->param("cverify")); }
Enjoy!