Paypal Express Checkout错误(不支持指定的方法)

时间:2013-04-08 13:15:32

标签: php paypal express-checkout

我是codeigniter和paypal的新手。我正在研究gocart(一种基于codeIgniter构建的开源电子商务解决方案)。我尝试使用集成在其中的paypal API,但其显示错误如下:

[ACK] => Failure [L_ERRORCODE0] => 81002 [L_SHORTMESSAGE0] => Unspecified Method [L_LONGMESSAGE0] => Method Specified is not Supported [L_SEVERITYCODE0] => Error
以下是我的代码: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 个答案:

答案 0 :(得分:0)

当Paypal返回此消息时,它是传输方法的一种情况,而不是方法参数/属性。

在Paypal中只接受POST。