codeigniter3 As you can see in the below PHP code I'm using the Paytm payment gateway in my project,
I want when the user to adds an item to the shopping cart and goes to the checkout button, the user should be redirected to the user shipping address submission page. After completing the information page, the user should be redirected to the checkout process order page with the total cart item amount where he can make the payment. What type of logic and data structure will I need for this, provide me source code or better guidance based on the MVC pattern or give me some code on model and controller worked with the complete query to execute the data structure.
user shipping address submission
$this->form_validation->set_rules('name', 'Name', 'required');
$this->form_validation->set_rules('email', 'Email', 'required|valid_email');
$this->form_validation->set_rules('password', 'Password', 'required');
$this->form_validation->set_rules('phone', 'Phone', 'required');
$this->form_validation->set_rules('address', 'Address', 'required');
checkout process order
$paramList["MID"] = PAYTM_MERCHANT_MID;
$paramList["ORDER_ID"] = 'id';
$paramList["CUST_ID"] = 'customer_id';
$paramList["INDUSTRY_TYPE_ID"] = INDUSTRY_TYPE_ID;
$paramList["CHANNEL_ID"] = $CHANNEL_ID;
$paramList["TXN_AMOUNT"] = $item["subtotal"];
$paramList["WEBSITE"] = PAYTM_MERCHANT_WEBSITE;
$paramList["CALLBACK_URL"] = base_url('Checkout/payment_response');
$paramList["MSISDN"] = 'xxxxxxxxxx'; //Mobile number of customer
$paramList["EMAIL"] = 'xxxxxxxxxx'; //Email ID of customer
$paramList["VERIFIED_BY"] = "MSISDN";
$paramList["IS_USER_VERIFIED"] = "YES";
$checkSum = $this->paytm->getChecksumFromArray($paramList,PAYTM_MERCHANT_KEY);
$transaction_url = PAYTM_TXN_URL;
$data = array('paramList' => $paramList,'transaction_url' => $transaction_url,'checkSum' => $checkSum);
// ,'order_id' => $order_id
$this->load->view('order_process',$data);
This is the callback_URL of the checkout process. Here I want if the payment status is successful then I should be shown the complete order information of the user according to the order ID submitted by the
callback_URL
$paytmChecksum = "";
$paramList = array();
$isValidChecksum = FALSE;
$paramList = $_POST;
$paytmChecksum = isset($_POST["CHECKSUMHASH"]) ? $_POST["CHECKSUMHASH"] : ""; //Sent by Paytm pg
$isValidChecksum = $this->paytm->verifychecksum_e($paramList, PAYTM_MERCHANT_KEY, $paytmChecksum); //will return TRUE or FALSE string.
if($isValidChecksum == "TRUE") {
if ($_POST["STATUS"] == "TXN_SUCCESS") {
//Here we can show order information
}else{
echo 'Transaction Failed';
}
}else{
echo 'Not Valid Check Sum';
}
Top comments (1)
please help to solve this