Dear Reader, let us we know that “How to integrate ONGO payment gateway in PHP“. So in this Tutorial, We Learn Step By Step Payment gateway integration Process in PHP.
If you are going develop the E-commerce website or application and wants to sell products then this tutorial for you.
Today we are going to Integrate “ONGO” payment gateway, This payment gateway is the simplest payment gateway for Integration and receiving the payments of Customers.
Now let’s start the Payment Gateway Integration Process in step by step.
First, we see a Snapshot of the Product Pay now page.
And you can also see Live “Demo” by click on below Demo button
Step 1:- First we need to create a database like “php_demo” and paste the below SQL code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
-- -- Table structure for table `orders` -- CREATE TABLE `orders` ( `id` int(11) NOT NULL, `order_id` int(11) NOT NULL, `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL, `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `paid_amount` varchar(10) COLLATE utf8_unicode_ci NOT NULL, `currency` varchar(10) COLLATE utf8_unicode_ci NOT NULL, `payment_status` varchar(50) COLLATE utf8_unicode_ci NOT NULL, `created_date` datetime NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; |
Step 2:- Now Create a folder like “Demo” and create a file “index.php” and paste the below code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
<!DOCTYPE html> <html lang="en"> <head> <title>How to integrate ONGO payment gateway in PHP</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> </head> <body> <div class="container-fluid"> <center> <h1 class="alert alert-success">How to integrate ONGO payment gateway in PHP</h1> </center> <form action="https://uatsys.agsindia.com:8006" method="POST" id="finalForm"> <div class="row"> <div class="col-sm-4 col-md-4"> <img src="images/default.jpeg" width="300px" height="350px"> </div> <div class="col-sm-4 col-md-4"> <div class="form-group"> <label>Product Name: Honor 7A (Gold, 32 GB) (3 GB RAM) </label> </div> <div class="form-group"> <label>Price: ₹7,999 </label> </div> <div> <label>Description: <p> Capture the best moments of your life with the 13MP + 2MP ultra sharp dual-lens camera. Up your selfie game with the 8MP front shooter with adjustable selfie toning light. The 14.47cm Honor FullView display with 18:9 aspect ratio delivers a bezel-less viewing experience for gaming, watching movies and online shopping. Featuring iAware 2.0 smart management, Honor 7A detects user behaviour and improve system efficiency. Powered by EMUI 8.0 based on Android 8.0, Honor 7A facilitates smart functional features like navigation dock, three-finger screenshot, one-click split and more</p> </label> </div> <div> <input type="hidden" name="MID" value="130000000001010"> <input type="hidden" name="TID" value="IB001010"> <input type="hidden" name="Mobilenumber" value="9999999999"> <input type="hidden" name="ReturnUrl" value="http://localhost/webpreparations/demo/how-to-integrate-ongo-payment-gateway-in-php/return.php"> <input type="hidden" name="Amount" value="7999"> <input type="hidden" name="PaymentDesc" value="This is Testing Payment by Web Preparations"> <input type="hidden" name="PaymentId" value="1504868023"> <input type="hidden" name="PF1" value="Web Preparations"> <input type="hidden" name="PF2" value="Tom"> <input type="hidden" name="PF3" value="tom@gmail.com"> <input type="submit" value="Buy Now" class="btn-lg btn-success"/> </div> </div> <div class="col-sm-4 col-md-4"> </div> </div> </form> </div> </body> </html> <?php include '../footer.php'; ?> |
Step 3:- Now create a file “config.php” and paste the below code
1 2 3 4 5 6 7 8 9 10 11 12 |
<?php define('DB_NAME','php_demo'); define('DB_USER','root'); define('DB_HOST','localhost'); define('DB_PASSWORD',''); $con = mysqli_connect(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME); if(!$con) { echo 'Database not connected'; } ?> |
Step 4:- Now create a file “return.php” and paste the below code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
<?php /*--------for include config and user config start ------*/ include 'config.php'; /*--------for include config and user config close ------*/ /*------------- for save order details start --------------*/ if(isset($_REQUEST['RSPCODE'])) { $order_id = 1; $name = trim($_REQUEST['PF2']); $email = trim($_REQUEST['PF3']); $amount = trim($_REQUEST['Amt']); $response = trim($_REQUEST['RSPCODE']); $currency = 'ÍNR'; $response = trim($_REQUEST['TranDate']); $status = 'success'; $created_date = date('Y-m-d H:i:s'); $insert_query = "INSERT INTO orders(order_id,name,email,paid_amount,currency,created_date) VALUES('$order_id','$name','$email','$amount','$currency','$created_date') "; //echo $insert_query; $result_insert = mysqli_query($con,$insert_query); } /*------------- for save order details close --------------*/ ?> <!DOCTYPE html> <html lang="en"> <head> <title>How to create google plus login in PHP</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> </head> <body> <div class="container-fluid"> <center> <h1 class="alert alert-success">How to integrate ONGO payment gateway in PHP </h1> </center> <form action="https://uatsys.agsindia.com:8006" method="POST" id="finalForm"> <div class="row"> <div class="col-sm-4 col-md-4"> <img src="images/default.jpeg" width="388.203px" height="476px"> </div> <div class="col-sm-4 col-md-4"> <div class="form-group"> <label>Product Name: Laptop Backpack(Black) </label> </div> <div class="form-group"> <label>Price: ₹489 </label> </div> <div> <label>Description: <p> Capture the best moments of your life with the 13MP + 2MP ultra sharp dual-lens camera. Up your selfie game with the 8MP front shooter with adjustable selfie toning light. The 14.47cm Honor FullView display with 18:9 aspect ratio delivers a bezel-less viewing experience for gaming, watching movies and online shopping. Featuring iAware 2.0 smart management, Honor 7A detects user behaviour and improve system efficiency. Powered by EMUI 8.0 based on Android 8.0, Honor 7A facilitates smart functional features like navigation dock, three-finger screenshot, one-click split and more</p> </label> </div> </div> <div class="col-sm-4 col-md-4"> </div> </div> </form> </div> </body> </html> |
Step 5:- Now run our project, so we need to type in browser localhost/your_project_name/index.php
like
“http://localhost/demo/index.php” then you can see the result as in below snapshot,
Step 6:- when you click on the “Pay Now” button then you will see the below snapshot
Step 7:- Test Payment detail is below:-
Testing URL: https://uatsys.agsindia.com:8006
Card Number : 4242 4242 4242 4242
Expiry Year: 2020
Expiry Month: 12
CVV: 123
Step 8:- The Production URL is below
URL: https://pg.myongo.co.in:8000/
Congratulations you have successfully created “How to integrate ONGO payment gateway in PHP”, if you like this post and was helpful for you then share this post on social media and if you have any query then please contact us or comment below, Thanks