我正在将CI-Merchant整合到Codeigniter项目中,以便使用Paypal和SagePay处理付款。
我已经完成了来自http://ci-merchant.org/的paypal_express的演示并且工作正常(或者至少在我使用示例代码时给了我一个正确的错误 - 请参阅下面的使用paypal代码的响应)
Merchant_response Object
(
[_status:protected] => failed
[_message:protected] => Security header is not valid
[_reference:protected] =>
[_data:protected] =>
[_redirect_url:protected] =>
[_redirect_method:protected] => GET
[_redirect_message:protected] =>
[_redirect_data:protected] =>
)
我更新了Sagepay的代码,如下所示
public function index()
{
$this->load->helper('language');
$this->load->library('merchant');
$this->merchant->load('sagepay_direct');
$settings = array (
'vendor' => 'testvendor',
'test_mode' => FALSE,
'simulator_mode' => TRUE,
);
$this->merchant->initialize($settings);
$params = array(
'description'=>'Test purchase',
'currency'=>'GBP',
'transaction_id'=>'12345',
'email'=>'test@person.com',
'first_name'=>'Test',
'last_name'=>'Person',
'address1'=>'1 Random Avenue',
'address2'=>'Made Up Drive',
'city'=>'Notarealcity',
'postcode'=>'FA11 1KE',
'country'=>'UK',
'region'=>'',
'phone'=>'0101010101',
'amount'=>125.00,
'card_no'=>'4444444444444444',
'name'=> 'Mr Test',
'card_type' => 'VISA',
'exp_month'=> 11,
'exp_year'=> 15,
'csc'=> 999
);
$response = $this->merchant->purchase($params);
echo '<pre>';
print_r($response);
exit;
}
并且该代码的输出是
Merchant_response Object
(
[_status:protected] => failed
[_message:protected] =>
[_reference:protected] =>
[_data:protected] =>
[_redirect_url:protected] =>
[_redirect_method:protected] => GET
[_redirect_message:protected] =>
[_redirect_data:protected] =>
)
哪个没有给我任何关于可能出错的信息。
我正在使用有效的供应商名称,并已将服务器的IP地址输入SagePay模拟器,请求来自的页面为https,请求来自的URL将添加到sage pay simulator帐户部分
看起来它应该是好的,但我现在被卡住了 - 我真的很感激任何帮助。
提前致谢
杰森
答案 0 :(得分:0)
PayPal错误通常意味着您尝试在测试模式下使用真实帐户,反之亦然。
我不确定为什么Sagepay根本没有报告任何错误。它可能与使用本地化错误消息的lang()函数有关,但我不确定。您可能需要向merchant_sagepay.php添加一些调试行,以查看真实的响应。
答案 1 :(得分:0)
您没有在$setting
变量
$settings = array(
'username' => 'API Merchants user name',
'password' => 'API Merchants passwrd',
'signature' => 'API Merchants signature',
'test_mode' => true);// for sand box its true else false
$this->merchant->initialize($settings);