2013-04-08 88 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。

相关问题