For an online payment, I am trying to use ci_merchant. According to http://ci-merchant.org/ , I made a CodeIgniter project. But the function is displaying only blank page.
My function is given below:
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;
}
}
Where is the problem of my code or procedure ? Awaiting for an affirmative response.
I think you missed the
$this->
part in below code snippet:try it with: