使用paypal的ci-merchant中的“无效令牌”

时间:2013-10-30 08:43:02

标签: codeigniter paypal ci-merchant

我正在尝试将paypal支付模块与我的一个应用程序集成。为此,我使用了ci-merchant。我做了以下代码:

控制器:

$this->load->helper('language');
$this->load->library('merchant');
$this->merchant->load('merchant_paypal_express');

$settings = array(
        'username' => 'amas***-facilitator_api1.opl****.com',
        'password' => '1383***828',
        'signature' => 'AQU0e5vuZCvSg*****oSa.sGUDlpAdkd1coWah3Y.Bvq-lz3WLKI-t-q',
        'test_mode' => true);

$this->merchant->initialize($settings);

$params = array(
    'amount' => 100.00,
    'currency' => 'USD',
    'return_url' => base_url().'payment',
    'cancel_url' => base_url().'payment'
);

$response = $this->merchant->purchase_return($params);
var_dump($response);

它给了我以下结果:

object(Merchant_response)[23]
  protected '_status' => string 'failed' (length=6)
  protected '_message' => string 'Invalid token.' (length=14)
  protected '_reference' => null
  protected '_data' => null
  protected '_redirect_url' => null
  protected '_redirect_method' => string 'GET' (length=3)
  protected '_redirect_message' => null
  protected '_redirect_data' => null

有人请告诉我无效令牌错误以及使用ci-merchat的最佳方式。

1 个答案:

答案 0 :(得分:0)

请添加

$settings = $this->merchant->default_settings();

and After that

$settings = array('username' => 'amas*-facilitator_api1.opl**.com',

              'password' => '1383***828',

              'signature' => 'AQU0e5vuZCvSg*****oSa.sGUDlpAdkd1coWah3Y.Bvq-lz3WLKI-t-q',
     'test_mode' => true)

;

'password' => '1383***828', 'signature' => 'AQU0e5vuZCvSg*****oSa.sGUDlpAdkd1coWah3Y.Bvq-lz3WLKI-t-q', 'test_mode' => true)