【发布时间】:2012-11-05 00:43:55
【问题描述】:
我正在尝试使用 CodeIgniter 制作一个小购物车,我发现 CI-Merchant 可以通过本指南 http://ci-merchant.org/ 与支付网关一起使用,但我真的不明白如何让它与 Paypal Sandbox 一起使用。
$this->load->library('merchant');
$this->merchant->load('paypal_express');
$settings = array(
'username' => 'test@test.com',
'password' => '********',
'signature' => 'Test Store',
'test_mode' => true);
$this->merchant->initialize($settings);
$params = array(
'amount' => 12.00,
'currency' => 'CAD',
'return_url' => 'http://payment.test.com',
'cancel_url' => 'http://payment.test.com/cancel');
$response = $this->merchant->purchase($params);
$this->load->view('welcome_message');
我知道这段代码不能做很多事情,但它什么也不做。只是加载视图,没有任何反应,我不明白。所以,我的问题是,你知道教程还是只是如何让 CI Merchant 与 Paypal Sandbox 一起工作?感谢您的帮助。
【问题讨论】:
-
尝试在
$this->load-view('welcome_message);之前打印$response这样的print "<pre>"; var_dump($response); print "</pre>";以查看结果。 -
所以我在
$this->load-view('welcome_message);之前添加了print "<pre>"; var_dump($response); print "</pre>";,然后我得到了object(Merchant_response)[17] protected '_status' => string 'failed' (length=6) protected '_message' => string 'Security header is not valid' (length=28) ...,然后我意识到我们需要使用“API 和支付卡凭据”而不是卖家账户的凭据。所以现在它可以工作了,我可以继续编码!
标签: codeigniter paypal-sandbox ci-merchant