How to Integrate Paytm Payment Gateway in PHP

0 173

As you know Paytm is highly popular wallet system in india and Now days it growing very fast, People uses Paytm on daily bases to recharge their mobile phones, DTH, bills etc Paytm is India’s largest mobile payments and commerce platform. It started with online mobile recharge and bill payments and has an online marketplace today. In a short span of time, Paytm have scaled to over 230 Mn registered users. So if you are looking for a payment / donation solutions for your website , I suggest you use Paytm Payment Gateway to receive payments from your customers. Because It is easy to integrate on your website. Paytm is easier as it is linked with many services which make the online transaction convenient for your website users. And they can easily securely pay you online for user service / products.

Paytm Payment Gateway Integrate in PHP

Integration of Paytm Payment Gateway on your website is quite simple you just have to download Paytm_Web_Sample_Kit_PHPAfter that follow below steps suggested by Paytm Web Kit.

Step-1: Copy PaytmKit folder in document root of your server (like /var/www/html).
Step-2: Open config_paytm.php file from the PaytmKit/lib folder and update the below constant values
config_paytm.php

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

Where
PAYTM_MERCHANT_KEY – Can be downloaded from the Paytm portal. One time downloadable
PAYTM_MERCHANT_MID – MID (Merchant ID) can be collected from Paytm team
PAYTM_MERCHANT_WEBSITE – Website name can be collected from Paytm team

Step-3: Now final step to create a sample html form with required filed, You can also find demo html form in PaytmKit/TxnTest.php, You can execute this file and test your Paytm Payment Gateway Integrate is working fine or not.

<form method="post" action="pgRedirect.php">
		<table border="1">
			<tbody>
				<tr>
					<th>S.No</th>
					<th>Label</th>
					<th>Value</th>
				</tr>
				<tr>
					<td>1</td>
					<td><label>ORDER_ID::*</label></td>
					<td><input id="ORDER_ID" tabindex="1" maxlength="20" size="20"
						name="ORDER_ID" autocomplete="off"
						value="<?php echo  "ORDS" . rand(10000,99999999)?>">
					</td>
				</tr>
				<tr>
					<td>2</td>
					<td><label>CUSTID ::*</label></td>
					<td><input id="CUST_ID" tabindex="2" maxlength="12" size="12" name="CUST_ID" autocomplete="off" value="CUST001"></td>
				</tr>
				<tr>
					<td>3</td>
					<td><label>INDUSTRY_TYPE_ID ::*</label></td>
					<td><input id="INDUSTRY_TYPE_ID" tabindex="4" maxlength="12" size="12" name="INDUSTRY_TYPE_ID" autocomplete="off" value="Retail"></td>
				</tr>
				<tr>
					<td>4</td>
					<td><label>Channel ::*</label></td>
					<td><input id="CHANNEL_ID" tabindex="4" maxlength="12"
						size="12" name="CHANNEL_ID" autocomplete="off" value="WEB">
				woring	</td>
				</tr>
				<tr>
					<td>5</td>
					<td><label>txnAmount*</label></td>
					<td><input title="TXN_AMOUNT" tabindex="10"
						type="text" name="TXN_AMOUNT"
						value="1">
					</td>
				</tr>
				<tr>
					<td></td>
				woring	<td></td>
					<td><input value="CheckOut" type="submit"	onclick=""></td>
				</tr>
			</tbody>
		</table>
		* - Mandatory Fields
</form>

See official Paytm Api documentation for more information. and know more about how Paytm payment gateway working.

Leave A Reply

Your email address will not be published.