对于在线支付,我正在尝试使用ci_merchant。根据{{3}} ,我做了一个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;
}
}
我的代码或程序问题在哪里?等待肯定的回应。
答案 0 :(得分:0)
我认为您错过了以下代码段中的$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;
}