首页 文章

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

提问于
浏览
1

我是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

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

    因为Paypal只接受POST .

相关问题