我正在尝试用CodeIgniter做一个小购物车,我发现CI-Merchant使用这个指南http://ci-merchant.org/与支付网关一起工作,但我真的不知道如何让它与贝宝沙盒一起工作。
$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一起工作吗?谢谢你的帮助。
发布于 2012-11-06 05:53:23
Ace的评论恰到好处。您的代码没有任何错误,但是您需要检查$response对象以查看结果(或错误消息)是什么。
$response = $this->merchant->purchase($params);
if ($response->success())
{
// mark order as complete
$gateway_reference = $response->reference();
}
else
{
$message = $response->message();
echo('Error processing payment: ' . $message);
exit;
}您也可以简单地尝试执行以下操作来检查对象:
$response = $this->merchant->purchase($params);
echo '<pre>';
print_r($response);
exit;https://stackoverflow.com/questions/13224575
复制相似问题