2

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

[ACK] => 失败 [L_ERRORCODE0] => 81002 [L_SHORTMESSAGE0] => 未指定的方法 [L_LONGMESSAGE0] => 不支持指定的方法 [L_SEVERITYCODE0] => 错误
下面是我的代码: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;
} 
4

1 回答 1

0

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

与 Paypal 一样,仅接受 POST。

于 2017-05-15T05:01:10.653 回答