0

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

函数 __construct()
{ 
$this->API_USERNAME ='用户名';
$this->API_PASSWORD = '密码';
$this->API_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 ?'; }

公共函数 doExpressCheckout($amount, $desc, $invoice='') {
$数据 = 数组( '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);
回声'';
print_r($return);
回声'';
if ($return['ACK'] == '成功') {
header('位置:'.$this->gate.'cmd=_express-checkout&useraction=commit&token='.$return['TOKEN'].'');
死(); }

返回($返回);}

公共函数 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);
回声'';
print_r($return);
回声'';

if ($return['ACK'] == '成功') {
header('位置:'.$this->gate.'cmd=_express-checkout&useraction=commit&token='.$return['TOKEN'].'');
死(); }

返回($返回); }

私有函数响应($data) {
$result = $this->CI->httprequest->connect($data);
如果($结果<400) 返回 $this->CI->httprequest;
返回错误;}

私有函数 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);
返回$查询; }

4

0 回答 0