我正在尝试使用CI-Merchant库来整合Paypal Pro(直接付款)而我迷路了..
我已经设置了一个英国沙箱(一个预先配置了paypal pro的卖家帐户,以及一个带有以下信息的买家帐户($ params数组)
以下是我收到的响应(状态失败,没有消息)以及我正在使用的$ params数组:
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] =>
)
Array
(
[card_type] => Visa
[card_no] => 4269072658337891
[first_name] => Buyer
[last_name] => One
[address1] => 1 Main Terrace
[city] => Wolverhampton
[region] => West Midlands
[postcode] => W12 4LQ
[amount] => 10
[currency] => GBP
[country] => UK
)
以下是代码:
$this->load->library('merchant');
$this->merchant->load('paypal_pro');
$settings = array(
'username' => '***',
'password' => '***',
'signature' => '***',
'test_mode' => true);
$this->merchant->initialize($settings);
//params array is set through a form submit.
$response = $this->merchant->purchase($params);
echo '<pre>';
print_r($response);
print_r($params);
exit;
请让我知道如何调试这个!
谢谢你, 乔治
答案 0 :(得分:0)
在此代码之后
$this->load->library('merchant');
$this->merchant->load('paypal_pro');
你需要初始化
$settings = $this->merchant->default_settings();
和bingo