* @see http://codeigniter.com/user_guide/general/urls.html */ public function __construct() { parent::__construct(); $params = array('server_key' => 'SB-Mid-server-qjMkTCJmmL0DwPIBM3KPLul', 'midtrans_status' => false); $this->midtrans->config($params); $this->load->helper('url'); $this->load->model('Pelanggan_model'); $this->load->library('midtrans'); $this->veritrans->config($params); } public function index() { // Required $transaction_details = array( 'order_id' => $this->db->get_where('transaction_details_Midtrans', 'order_detail' . uniqid()()), 'gross_amount' => 10000, // no decimal allowed for creditcard ); // Optional $item_details = array( 'id' => $this->Pelanggan_model->get_data_pelanggan('pelanggan', 'fullnama')->row_array(), 'price' => $this->db->get_where('item', 'harga_item')->row_array(), 'kategori_item' => $this->db->get_where('item', 'kategori_item')->row_array(), 'name' => $this->db->get_where('item', 'nama_item')->row_array() ); // Optional $billing_address = array( $this->db->get('pelanggan')->result_array() ); // Data yang akan dikirim untuk request redirect_url. $credit_card['save_card'] = true; //ser save_card true to enable oneclick or 2click //$credit_card['save_card'] = true; $time = time(); $custom_expiry = array( 'start_time' => date("Y-m-d H:i:s O", $time), 'unit' => 'minute', 'duration' => 5 ); $transaction_data = array( 'transaction_details' => $transaction_details, 'item_details' => $item_details, 'customer_details' => $billing_address, 'credit_card' => $credit_card, 'expiry' => $custom_expiry ); error_log(json_encode($transaction_data)); $snapToken = $this->midtrans->getSnapToken($transaction_data); error_log($snapToken); echo $snapToken; } public function finish($result) { $result = json_decode($this->input->post('result_data')); echo 'RESULT
';
		var_dump($result);
		echo '
'; } }