YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

PayPal NVP API - Keep getting error 81002 Options
ang89
#1 Posted : Monday, May 03, 2010 1:25:15 PM
Rank: Starting Member

Groups: Registered

Joined: 5/3/2010
Posts: 1
Location: Indonesia
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.

Code:
<?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:

Code:
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.
Sponsor  
 
nds_webdesign
#2 Posted : Wednesday, May 12, 2010 5:08:55 AM
Rank: Junior Member

Groups: Registered

Joined: 10/15/2009
Posts: 159
Location: Omaha, NE USA
I used your API credentials and it worked with this request:

Code:


API Request:

USER=andree_1272823561_biz_api1.gmail.com
PWD=1272823576
SIGNATURE=Am1t0wiu2tv7VwZ5ebdeY9zv1GF6Ad0PFz-qTGFFf7vbWU6ee4bxy8KL
METHOD=SetExpressCheckout
VERSION=59.0
RETURNURL=https://localhost
CANCELURL=https://localhost
PAYMENTACTION=Sale
AMT=0.01
CURRENCYCODE=USD
DESC=test EC payment

API Response:

TOKEN=EC-2U787211KJ179373C
TIMESTAMP=2010-05-12T07:07:55Z
CORRELATIONID=993b3779d5b9e
ACK=Success
VERSION=59.0
BUILD=1288906
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAFVision Theme by Jaben Cargman (Tiny Gecko)
Powered by YAF | YAF © 2003-2009, Yet Another Forum.NET
This page was generated in 0.134 seconds.