1

我正在尝试将贝宝支付模块与我的一个应用程序集成。为此,我使用了 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 的最佳方式是什么。

4

1 回答 1

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)

;

于 2013-10-30T13:26:00.217 回答