Paypal API中的请求参数无效

时间:2013-11-25 16:20:41

标签: perl paypal

您好我刚拿起perl的代码示例,并尝试使用以下内容向我的沙盒开发人员测试帐户付款

sub promote {
    my $headers = HTTP::Headers->new(
    'X-PAYPAL-SECURITY-USERID'=> 'alexjaquet-facilitator_api1.gmail.com',
    'X-PAYPAL-SECURITY-PASSWORD' => 'xxxxx',
    'X-PAYPAL-SECURITY-SIGNATURE' => 'An5ns1Kso7MWUdW4ErQKJJJ4qi4-  
                                      3fjxb5G1RfUPmQ5kIdwdsH7znTJ',
    'X-PAYPAL-SERVICE-VERSION' => '1.1.0',
    'X-PAYPAL-APPLICATION-ID' => 'APP-80W284485P519543T',
    'X-PAYPAL-REQUEST-DATA-FORMAT' => 'NV',
    'X-PAYPAL-RESPONSE-DATA-FORMAT' => 'NV');

 my $content = sprintf("%s&%s&%s&%s&%s&%s&%s&%s&%s&%s&%s&%s&%s&%s&%s", 
   'senderEmail=alexjaquet-facilitator@gmail.com',
   'actionType=PAY',
   'currencyCode=USD',
   'feesPayer=EACHRECEIVER',
   'receiverList.receiver(0).email=alexjaquet-facilitator@gmail.com ',
   'receiverList.receiver(0).primary=false',
   'receiverList.receiver(0).amount=20.00',
   'returnUrl=http:myreturnurl',
   'cancelUrl=http:mycancelurl',
   'requestEnvelope.errorLanguage=en_US',
   'clientDetails.ipAddress=127.0.0.1',
   'clientDetails.deviceId=mydevice',
   'clientDetails.applicationId=PayNvpDemo');


my $req = HTTP::Request->new($method,'https://svcs.sandbox.paypal.com/AdaptivePayments
                                      /Pay',$headers, $content);
my $ua = LWP::UserAgent->new;

my $res = $ua->request($req);
if ($res->is_success) {
    print "Content-Type: text/html\n\n";
print $res->content;}
else {
        print "Content-Type: text/html\n\n";
    print $res->status_line, "\n";}

}

但我得到的答案如下:

  

错误(0)。域= PLATFORM&安培;错误(0).subdomain =应用&安培;错误(0).severity =错误&安培;错误(0).category =应用&安培;错误(0).message =无效+请求+参数%3A +电子邮件+ alexjaquet调解人%40gmail.com ++为+无效&安培;错误(0)。参数(0)= email和安培;错误(0)。参数(1)= alexjaquet-主持人%40gmail.com +

0 个答案:

没有答案