card payments using clickbank
ClickBank is the first choice for many people selling digital products from their web site.
An account is easy to set-up and reasonably priced. However many people are worried about having their order download page passed around and losing out on sales.
ClickBank do provide a solution to this but it's not easy for the average site owner to implement.
The Perl script below will validate a ClickBank purchase by checking and order has actually been placed and paid for.
The first step is to log into your ClickBank account and set-up your validation key. If you don't have a ClickBank account you can signup here, this will open another window, just click on the 'Click HERE to learn more about becoming a vendor' link when the page opens up.
Step 2, once you're logged in choose the 'Click HERE to modify your account' option.
Step 3, on the next page choose the same option 'Click HERE to modify your account'.
Step 4, Scroll down to the bottom of the page and look for:
Advanced Settings: Cgi purchase validation (for experienced programmers only):
In the text box enter your secret 16 digit key - this can be any combination of letters and numbers of your choice.
A little higher on the same page change your thank you page url to point to the cgi script i.e. http://www.yourdomain.com/cgi-bin/validate.cgi
Step 5, modify the script below as detailed in the instructions at the bottom of this page.
Validation Script - clickbank_validate.cgi
#!/usr/bin/perl
$url='http://www.yourdomain.com';
$valid_purchase=&valid;
if ($valid_purchase == 1) { #valid order display download page print "Content-type: text/html\n\n"; print <<end_html; your html page code to link to your download or sale confirmation page goes here
end_html } else { #redirect to sales page print "Location: $url\n\n"; }
exit;
sub valid { ### Copyright Keynetics Inc. Patents pending. my($a,$b,$c,$h,$i,$l,$q,$w,$x,$y,$z,@s,@v); ############################### $a='your_secret_key_here'; ############################### $q='&'.substr($ENV{'QUERY_STRING'},0,256); $q=~/\Wseed=(\w+)/; $b=$1; $q=~/\Wcbpop=(\w+)/; $c=$1; return 0 unless $a&&$b&&$c; $h=0x80000000; $l=0x7fffffff; $q=''; $w=uc "$a $b"; $x=$y=$z=17; @v=unpack("C*",$w); $n=1+$#v; for($i=0;$i<256;$i++) { $w=(($x&$l)+($y&$l))^(($x^$y)&$h); $w=($w<<$z)|($w>>(32-$z)); $w=(($w&$l)+$v[$i%$n])^($w&$h); $s[$i&7]+=$w&31; $z=$y&31; $y=$x; $x=$w; } for ($i=0;$i<8;$i++) { $q.=substr('0123456789BCDEFGHJKLMNPQRSTVWXYZ',$s[$i]&31,1); } return $c eq $q; }
Modification Notes:
Change $url='http://www.yourdomain.com'; so it holds your website address.
Replace:
your html page code to link to your download or sale confirmation page goes here
With the code of your existing html thankyou page or enter your new html code.
Finally, update $a='your_secret_key_here'; with the 16 digit secret key you entered in your ClickBank account.
The last step is to change the order url on your sales page to:
http://www.clickbank.net/sell.cgi?link=seller/1/test&seed=41FLZ9FJ
Replace seller with your ClickBank id, 1 will be your product number, test is your product name and seed is a value of your choice.
|