Paypal NVP API - Keep getting error 81002
Posted
by Andree
on Stack Overflow
See other posts from Stack Overflow
or by Andree
Published on 2010-05-03T13:44:27Z
Indexed on
2010/05/03
13:48 UTC
Read the original article
Hit count: 649
Hi there,
I am new to PayPal API, and I'm having trouble calling SetExpressCheckout using CURL in PHP. I have set everything correctly, as far as I'm concerned, but I kept getting an 81002 error "Method Specified is not Supported".
The code snippet is below. I got the CA Root certificates file from here.
<?php
$paypal_data = array(
'USER' => urlencode('andree_1272823561_biz_api1.gmail.com'),
'PWD' => urlencode('1272823576'),
'SIGNATURE' => urlencode('Am1t0wiu2tv7VwZ5ebdeY9zv1GF6Ad0PFz-qTGFFf7vbWU6ee4bxy8KL'),
'VERSION' => urlencode('52.0'),
'PAYMENTACTION' => urlencode('Sale'),
'METHOD' => urlencode('SetExpressCheckout'),
'AMT' => urlencode('52.00'),
'RETURNURL' => urlencode('get_express_checkout_details.php'),
'CANCELURL' => urlencode('index.php')
);
$url = 'https://api-3t.sandbox.paypal.com/nvp?' . http_build_query($paypal_data);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CAINFO, dirname(__FILE__) . '/cacert.pem');
$result = curl_exec($curl);
curl_close($curl);
parse_str($result, $result);
?>
<pre>Data sent: <?php print_r($paypal_data); ?></pre>
<pre>Result: <?php print_r($result); ?></pre>
When I run the code, the output is the following:
Data sent: Array
(
[USER] => andree_1272823561_biz_api1.gmail.com
[PWD] => 1272823576
[SIGNATURE] => Am1t0wiu2tv7VwZ5ebdeY9zv1GF6Ad0PFz-qTGFFf7vbWU6ee4bxy8KL
[VERSION] => 52.0
[PAYMENTACTION] => Sale
[METHOD] => SetExpressCheckout
[AMT] => 52.00
[RETURNURL] => get_express_checkout_details.php
[CANCELURL] => index.php
)
Result: Array
(
[ACK] => Failure
[L_ERRORCODE0] => 81002
[L_SHORTMESSAGE0] => Unspecified Method
[L_LONGMESSAGE0] => Method Specified is not Supported
[L_SEVERITYCODE0] => Error
)
Anyone knows what could be the problem?
Regards, Andree.
© Stack Overflow or respective owner