Paytm Payment Gateway Integration Using PHP

Paytm is a very popular payment gateway in India for mobile payment and as well as for website online payment. Paytm is very simple and flat pricing for all business, like you will sell goods in 100(INR) then you will receive an amount of around 97.66(INR). Paytm is the safest and most secure payment gateway in India for online transactions.


paytm-payment-gateway-india

Paytm payment charges on the amount are very nominal. Paytm supports friction-less payment flow ensuring the lowest user drop and highest transaction success rates in Industry. Settlement of all your transaction funds automatically to your bank account on T+1 day. Paytm support INR currency only.

You can check other recommended tutorials of Payment Gateway,

How to use Paytm with PHP

This tutorial help to integrate Paytm Payment Gateway with PHP. I will follow following steps to add the Paytm gateway. We will create a folder into xampp 'd:/xampp/htdocs/paytm_gateway', this is our main project folder that will keep all files and libs.

Step 1: We will download Paytm Payment Gateway PHP Library.We will extract and save into 'd:/xampp/htdocs/paytm_gateway' folder.

Step 2: We will open config_paytm.php file, the location is 'd:/xampp/htdocs/paytm_gateway/Paytm_Web_Sample_Kit_PHP-master\PaytmKit\lib\'.We will change account configuration values.

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

Step 3: We will create bootstrap from to input the amount which will pay using the Paytm payment gateway, There are some required fields we need to send with the amount like cust_id, order_id, payment_type etc.

<form class="form-inline" action="pgRedirect.php" method="post"><input id="ORDER_ID" tabindex="1" autocomplete="off" maxlength="20" name="ORDER_ID" size="20" type="hidden" value="<?php echo ">"&gt; <input id="CUST_ID" tabindex="2" autocomplete="off" maxlength="12" name="CUST_ID" size="12" type="hidden" value="CUST001"> <input id="INDUSTRY_TYPE_ID" tabindex="4" autocomplete="off" maxlength="12" name="INDUSTRY_TYPE_ID" size="12" type="hidden" value="Retail"> <input id="CHANNEL_ID" tabindex="4" autocomplete="off" maxlength="12" name="CHANNEL_ID" size="12" type="hidden" value="WEB">
<p>&nbsp;</p>
<div class="form-group"><label for="exampleInputName2">Amount : </label>
<p>&nbsp;</p>
<div class="input-group"><span class="input-group-addon">$</span> <input id="TXN_AMOUNT" class="form-control" name="TXN_AMOUNT" type="text" aria-label="Amount (to the nearest ruppes)"></div>
</div>
<p><button id="name=" class="btn btn-primary" name="TXN_AMOUNT" type="submit"><i class="fa fa-paypal">Pay using Paytm</i></button><i class="fa fa-paypal"> </i></p>
</form>

I hope it helps you, feel free to ask questions using the comment section.