-
Home
-
Blogs
-
How-to-integrate-paytm-payment-gateway-in-php -
How to Integrate PAYTM Payment Gateway in PHP
By Deepak Sharma | Jan, 03 2019 06:44

How to Integrate PAYTM Payment Gateway in PHP
Hello Friends today I am talking about how we can integrate Paytm Payment Gateway in PHP Based website, in simply and easy way with video tutorial.
Believe me, most of the time we are facing problem during integration of any type of payment gate way, but it is not much hard as we think. Today I shall tell you to integrate Paytm payment gateway in PHP websites.
These are the follow steps:
Step 1: First of all we need a php integration kit of Paytm that will provided by Paytm (https://github.com/Paytm-Payments/Paytm_Web_Sample_Kit_PHP) download from this url.
Step 2: Now extract the .zip in to your localhost root folder(www or htdocs).
Step 3: Now we found 4 files(pgRedirect.php,pgResponse.php,TxnStatus.php,TxnTest.php) and 1 folder(lib).
Step 4: Now click on lib floder, there are 2 files as config_paytm.php and encdec_paytm.php.
Step 5: Now open config_paytm.php. This file contents all criedentials of paytm gateways such as
define("PAYTM_ENVIRONMENT", "TEST"); // PROD
define("PAYTM_MERCHANT_KEY", "xxxxxxxxxxxxxxxxxxxxxxxx"); //Change this constant"s value with Merchant key downloaded from portal
define("PAYTM_MERCHANT_MID", "xxxxxxxxxxxxxxxxxxxxxxx"); //Change this constant"s value with MID (Merchant ID) received from Paytm
define("PAYTM_MERCHANT_WEBSITE", "xxxxxxx"); //Change this constant"s value with Website name received from Paytm
here PAYTM_ENVIRONMENT are 2 type TEST / PROD, at first we will integrate gateway in TEST mode after succesfully 2-3 transaction on test mode then switch on PROD mode (Production mode paytm crediantials are different then testing mode that provide by Paytm Team after successfully on testing mode.)
PAYTM_MERCHANT_MID is also provide by the paytm team via email..
PAYTM_MERCHANT_KEY is also provide by the paytm team via email.
PAYTM_MERCHANT_WEBSITE this is also a unique and also provide by the paytm team via email.
Set are these criedentials correctly.
Step 6: Now open pgRedirect.php file.
$ORDER_ID = $_POST["ORDER_ID"];
$CUST_ID = $_POST["CUST_ID"];
$INDUSTRY_TYPE_ID = $_POST["INDUSTRY_TYPE_ID"];
$CHANNEL_ID = $_POST["CHANNEL_ID"];
$TXN_AMOUNT = $_POST["TXN_AMOUNT"];
// Create an array having all required parameters for creating checksum.
$paramList["MID"] = PAYTM_MERCHANT_MID;
$paramList["ORDER_ID"] = $ORDER_ID;
$paramList["CUST_ID"] = $CUST_ID;
$paramList["INDUSTRY_TYPE_ID"] = $INDUSTRY_TYPE_ID;
$paramList["CHANNEL_ID"] = $CHANNEL_ID;
$paramList["TXN_AMOUNT"] = $TXN_AMOUNT;
$paramList["WEBSITE"] = PAYTM_MERCHANT_WEBSITE;
$paramList["CALLBACK_URL"] = "http://localhost/PaytmKit/pgResponse.php";
$paramList["MSISDN"] = $MSISDN; //Mobile number of customer
$paramList["EMAIL"] = $EMAIL; //Email ID of customer
$paramList["VERIFIED_BY"] = "EMAIL"; //
$paramList["IS_USER_VERIFIED"] = "YES"; //
All above variable are reqired in post method in form will discuse later.
Step 7: Now open TxnTest.php
in this file creating form that is submitting to paytm payment gateways
0 comments