【问题标题】:"Invalid Token" in ci-merchant with paypal带有贝宝的 ci-merchant 中的“无效令牌”
【发布时间】:2013-11-09 17:54:03
【问题描述】:

我正在尝试将 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

请告诉我Invalid token 错误以及使用 ci-merchat 的最佳方式。

【问题讨论】:

  • @Adrian Macneil 你能给我一个解决方案吗?
  • 顺便说一句,您不使用 Omnipay 有什么原因吗? CI-merchant 不受支持,不会得到任何进一步的开发。
  • 你为什么要调用purchase_return()?您需要先调用 purchase()。
  • @AdrianMacneil 非常感谢。我将在下一个项目中使用 Omnipay。

标签: codeigniter paypal ci-merchant


【解决方案1】:

请补充

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

之后

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

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

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

;

【讨论】:

  • 我不明白你的意思。为什么我已经使用自定义设置时需要使用 default_settings?顺便说一句,我从评论中得到了答案。
猜你喜欢
  • 2013-06-14
  • 2017-03-16
  • 2011-02-20
  • 2018-01-21
  • 2015-05-26
  • 2021-05-11
  • 1970-01-01
  • 1970-01-01
  • 2014-10-26
相关资源
最近更新 更多