2013-04-08 63 views
1

我是codeigniter和paypal的新手。我正在開發gocart(一種基於codeIgniter的開源電子商務解決方案)。我嘗試在貝寶API集成到它的工作,但它的示值誤差爲: Paypal Express Checkout Error(不支持指定方法)

 
[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; 
} 
+0

通常,當您未通過有效方法時會生成此錯誤,但可能是由於未正確傳遞其他內容而導致的。你能否提供你正在發送的API請求字符串,減去你的API憑證。 – 2013-04-08 15:50:41

+0

由於我手動點擊請求,它會成功。請求是:https://api-3t.sandbox.paypal.com/nvp?PAYMENTACTION=Sale&AMT=24&RETURNURL=http://182.18.165.252/eshop&CANCELURL=http://182.18.165.252/eshop&METHOD=SetExpressCheckout&USER=xxx&PWD=xxxx&SIGNATURE = xxxx&VERSION = 56.0 – 2013-04-09 04:48:13

+0

你可以提供你的字符串作爲你的問題的一部分。由於它在評論部分中的顯示方式,我無法看到您發送的完整鏈接。 – 2013-04-09 13:25:02

回答

0

貝寶返回此消息時,它的發射方法的情況下,不是方法參數/屬性。

在PayPal只接受POST。

相關問題