#!/usr/bin/perl use warnings; use strict; use HTTP::Request::Common; use LWP::UserAgent; use XML::Simple; my $user = 'andy.business_api1.123.co.uk'; my $password = 'some password'; my $signature = 'my key'; my $application_id = 'APP-xxxxx'; my $url = 'https://svcs.sandbox.paypal.com/AdaptivePayments/Pay'; use SOAP::Lite; eval "use SOAP::Lite +trace => 'debug';"; # create header for requests my $authHeader = SOAP::Header->name("xsd:authHeader" => \SOAP::Header->value( SOAP::Header->name('X-PAYPAL-SECURITY-USERID')->value($user)->type(''), SOAP::Header->name('X-PAYPAL-SECURITY-PASSWORD')->value($password)->type(''), SOAP::Header->name('X-PAYPAL-SECURITY-SIGNATURE')->value($signature)->type(''), SOAP::Header->name('X-PAYPAL-APPLICATION-ID')->value($application_id)->type(''), SOAP::Header->name('X-PAYPAL-DEVICE-IPADDRESS')->value($ENV{REMOTE_ADDR})->type(''), SOAP::Header->name('X-PAYPAL-MESSAGE-PROTOCOL'1)->value('SOAP11')->type(''), )); my $soap = SOAP::Lite->new( proxy => $url); $soap->on_debug(sub { print @_ }); $soap->default_ns('urn:HelloWorld'); my $som = $soap->call('sayHello', SOAP::Data->name('name')->value('Kutter'), SOAP::Data->name('givenName')->value('Martin'), $authHeader ); die $som->faultstring if ($som->fault); print $som->result, "\n"; #### my $ua = LWP::UserAgent->new(); my $headers = HTTP::Headers->new( 'X-PAYPAL-SECURITY-USERID' => $user, 'X-PAYPAL-SECURITY-PASSWORD' => $password, 'X-PAYPAL-SECURITY-SIGNATURE' => $signature, 'X-PAYPAL-APPLICATION-ID' => $application_id, 'X-PAYPAL-DEVICE-IPADDRESS' => $ENV{REMOTE_ADDR}, 'X-PAYPAL-MESSAGE-PROTOCOL' => 'SOAP11'); my $format = '%s' x 8; my $content = qq| ReturnAll en_US PAY USD 5 andy.newby\@gmail.com http://paypal.site.com/paypal/class/1.2/Pay_Return.html http://paypal.site.com/paypal/class/1.2/Pay_Cancel.html AP-xxxxxxxxxxxxx |; my $request = HTTP::Request->new( 'POST', $url, $headers, $content ); my $response = $ua->request( $request ); print $response->decoded_content; use Data::Dumper; print Dumper(XMLin($response->decoded_content)); #### ReturnAll en_US PAY http://paypal.angelleye.com/paypal/class/1.2/Pay_Cancel.php APP-80W284485P519543T 37.187.79.225 Always Give Back USD 10.00 sandbo_1204199080_biz@angelleye.com 5.00 usb_1329725429_biz@angelleye.com 123-ABCDEF http://paypal.angelleye.com/paypal/class/1.2/Pay_Return.php