<?php // Include the paypal library include_once 'TwoCo.php'; // Create an instance of the authorize.net library $my2CO = new TwoCo(); // Log the IPN results $my2CO->ipnLog = TRUE; // Specify your authorize login and secret $my2CO->setSecret('YOUR_SECRET_KEY'); // Enable test mode if needed $my2CO->enableTestMode(); // Check validity and write down it if ($my2CO->validateIpn()) { file_put_contents('2co.txt', 'SUCCESS'); } else { file_put_contents('2co.txt', "FAILURE\n\n" . $my2CO->ipnData); }
function two_checkout() { // Include the paypal library include_once APPPATH . 'libraries/payment/TwoCo.php'; $this->gateway = '3'; $gate = $this->db->get_where('gateways', array('name' => 'twoco'))->row(); $gate_conf = unserialize($gate->settings); // Create an instance of the authorize.net library $my2CO = new TwoCo(); // Log the IPN results // $my2CO->ipnLog = TRUE; // Specify your authorize login and secret $my2CO->setSecret($gate_conf['secret_id']); // Enable test mode if needed $my2CO->enableTestMode(); // Check validity and write down it if ($my2CO->validateIpn()) { $settings = unserialize(base64_decode($my2CO->ipnData['custom'])); if ($settings['type'] == 'reg') { $this->_newUserPayment($settings['user_id'], $my2CO->ipnData['total']); redirect('/user/pay_complete'); } redirect('/user/pay_cancel'); } else { $this->_logError($my2CO->ipnData); redirect('/user/pay_cancel'); } }