#--CUT---- Google Checkout Request function
sub gcoreq {
my ($xml) = @_;
my $ua = LWP::UserAgent->new();
my $url = "https://checkout.google.com/cws/v2/Merchant/$GCOID/request";
my $cred = encode_base64($GCOID . ':' . $GCOKEY);
my $req = POST $url,
Authorization => "Basic $cred",
Content_Type => 'application/xml',
Accept => 'application/xml',
Content => $xml;
my $res = $ua->request($req);
return $res->content;
}
#--CUT--- Program take a filename as an argument and returns the encoded cart and signature
#!/usr/bin/perl
use MIME::Base64;
use Digest::SHA qw(hmac_sha1 );
my $key = '8yeeFR2tbqFghSnzmerijl';
if ($ARGV[0] eq '-sand') {
$key = 'x8tturq2DbJ4cj6RQaUBWZ';
shift;
}
open (IN, $ARGV[0]);
undef $/;
my $cart = ;
close IN;
my $ecart = encode_base64($cart, '');
my $signature = hmac_sha1($cart, $key);
my $esig = encode_base64($signature,'');
print "$ecart\n$esig\n";