2
votes

I am new to codeigniter and paypal. I am working on gocart(an open source eCommerce solution built on codeIgniter). I try to work on paypal API integrated in it, but its showing error as follows :

[ACK] => Failure [L_ERRORCODE0] => 81002 [L_SHORTMESSAGE0] => Unspecified Method [L_LONGMESSAGE0] => Method Specified is not Supported [L_SEVERITYCODE0] => Error
Below is my code : paypal_expres.php
$this->RETURN_URL = 'www.example.com';
$this->CANCEL_URL = 'www.example.com';
$this->currency = 'USD';
$this->host = "api-3t.sandbox.paypal.com";
$this->gate = 'https://www.sandbox.paypal.com/cgi-bin/webscr?';


public function doExpressCheckout($amount, $desc, $invoice='') { 
    $data = array( 
      'PAYMENTACTION' =>'Sale',
      'AMT' => '24',
      'RETURNURL' => $this->getReturnTo(),
      'CANCELURL' => $this->getReturnToCancel(),
      'CURRENCYCODE'=> $this->currency,
      'METHOD' => 'SetExpressCheckout'
    ); 
    $query = $this->buildQuery($data);
    $result = $this->response($query);  
    $response = $result->getContent();
    $return = $this->responseParse($response);  
    echo ''; 
    print_r($return);
    echo '';
    if ($return['ACK'] == 'Success') {
        header('Location: '.$this->gate.'cmd=_express-checkout&useraction=commit&token='.$return['TOKEN'].''); 
    }
    return($return);
}

public function doExpressCheckout($amount, $desc, $invoice='') {
    $data = array( 
      'PAYMENTACTION' =>'Sale',
      'AMT' => '24',
      'RETURNURL' => $this->getReturnTo(),
      'CANCELURL' => $this->getReturnToCancel(),
      'CURRENCYCODE'=> $this->currency,
      'METHOD' => 'SetExpressCheckout'
    );
    $query = $this->buildQuery($data);
    $result = $this->response($query);
    $response = $result->getContent();
    $return = $this->responseParse($response);
    echo ''; 
    print_r($return);
    echo '';
    if ($return['ACK'] == 'Success') {
        header('Location: '.$this->gate.'cmd=_express-checkout&useraction=commit&token='.$return['TOKEN'].'');
        die(); 
    }
    return($return); 
}

private function response($data) {
    $result = $this->CI->httprequest->connect($data);
    if ($result<400) return $this->CI->httprequest;
    return false;
}
private function buildQuery($data = array()) {
    $data['USER'] = $this->API_USERNAME;
    $data['PWD'] = $this->API_PASSWORD;
    $data['SIGNATURE'] = $this->API_SIGNATURE; 
    $data['VERSION'] = '56.0';
    $query = http_build_query($data);
    return $query;
} 
1
Typically this error is generated when you are not passing over a valid method, but can be caused by other things not being passed over correctly. Can you provide your API request string that you are sending over, minus your API credentials.PP_MTS_Chad
As I am hitting request manually, then it comes success. Request is : api-3t.sandbox.paypal.com/…Sushil Cyberlinks
Can you provide your string as part of your question post. I can't see the entire link of what you are sending over due to how it is being displayed in the comment section.PP_MTS_Chad

1 Answers

0
votes

When Paypal returns this message it's a case of transmit method, not the method argument/property.

As in Paypal only accepts POST.