私はcodeigniterとpaypalが初めてです。私は gocart (codeIgniter 上に構築されたオープン ソースの e コマース ソリューション) に取り組んでいます。それに統合された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($金額、$desc、$invoice='')
{
$data = 配列(
'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($リターン);
エコー '';
if ($return['ACK'] == '成功')
{
header('Location: '.$this->gate.'cmd=_express-checkout&useraction=commit&token='.$return['TOKEN'].'');
ダイ(); }
リターン($リターン);}
パブリック関数 doExpressCheckout($金額、$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($リターン);
エコー '';
if ($return['ACK'] == '成功')
{
header('Location: '.$this->gate.'cmd=_express-checkout&useraction=commit&token='.$return['TOKEN'].'');
ダイ(); }
リターン($リターン);
}
プライベート関数の応答($data)
{
$result = $this->CI->httprequest->connect($data);
if ($result<400)
戻る
$this->CI->httprequest;
false を返す;}
プライベート関数 buildQuery($data = array())
{
$data['USER'] = $this->API_USERNAME;
$data['PWD'] = $this->API_PASSWORD;
$data['SIGNATURE'] = $this->API_SIGNATURE;
$data['バージョン'] = '56.0';
$query = http_build_query($data);
$クエリを返します。
}