php - Paypal Express Checkout Error in CodeIgniter, Gocart(Method Specified is not Supported) -
i new codeigniter , paypal. working on gocart(an open source ecommerce solution built on codeigniter). try work on paypal api integrated in it, showing error follows : [ack] => failure [l_errorcode0] => 81002 [l_shortmessage0] => unspecified method [l_longmessage0] => method specified not supported [l_severitycode0] => error
below code : paypal_expres.php
function __construct() {
$this->api_username ='username';
$this->api_password = 'password';
$this->api_signature ='signature';
$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'].'');
die(); }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; }
Comments
Post a Comment