对于在线支付,我正在尝试使用ci_merchant。根据http://ci-merchant.org/,我做了一个CodeIgniter项目。但是该函数只显示空白页。
我的功能如下:
function transaction(){
$this->load->library('merchant');
$this->merchant->load('paypal_express');
$settings = $this->merchant->default_settings();
$settings = array(
'username' => 'AAAAAAAAAAA',
'password' => '111111',
'signature' => 'AAAAAAAAAAAARCpSSRl31AoJ0SIOUHEnDbhhEgANdZeAmMTkU',
'test_mode' => true
);
$this->merchant->initialize($settings);
$params = array(
'amount' => 1.00,
'currency' => 'USD',
'return_url' => 'http://localhost/tcm/account/transaction_return',
'cancel_url' => 'http://localhost/tcm/account/transaction_cancel'
);
//'return_url' => 'https://www.example.com/checkout/payment_return/123',
//'cancel_url' => 'https://www.example.com/checkout');
$response = $this->merchant->purchase($params);
if ($response->success()){
echo "Successfully complete transaction.";
}
else{
$message = $response->message();
echo('Error processing payment: ' . $message);
exit;
}
}
我的代码或过程的问题在哪里?等待肯定回复
我想你错过了下面代码片段中的$this->
部分:
if ($response->success()){
echo "Successfully complete transaction.";
}
else{
$message = $response->message();
echo('Error processing payment: ' . $message);
exit;
}
试试:
if ($response->$this->success()){
echo "Successfully complete transaction.";
}
else{
$message = $response->$this->message();
echo('Error processing payment: ' . $message);
exit;
}