Paytm Payment Gateway Integration in PHP : Step by Step

Paytm Payment Gateway Integration in PHP
In this tutorial we have explained Paytm Payment Gateway Integration in PHP programming language. In today scenario Paytm is most popular and trusted mobile wallet system. As per the Economic times survey Paytm reached approx 200 million registered users. Yes, that is huge number.

After demonetization in India, Paytm become more popular. Now most of users pay Bills, and transfer money via Paytm service. Its very easy to use and off course very fast.

Today many eCommerce or other service websites start using Paytm payment gateway. Its also reduce the risk to exposing credit card details or banking password. Just send or receive payment via your Mobile Phone. So, no doubt Paytm is better service for online payment for your Website or Mobile App.

Steps to Integrate Paytm Payment Gateway in PHP

Lets start the process of Paytm Payment Gateway Integration. Its very easy to integrate in your application as compare to other payment gateway. Follow the below steps:

Step 1 : Register for Paytm Account

Sign Up for Paytm bussiness account from here : https://paytm.com/business/payments/online

During Sign up process, you need to choose option that Paytm Payment Gateway require for an Website or APP. Also submit valid Redirect URL, where you want to redirect user after successful payment received.

In registration process, they ask some official information like Business Types, Address, Verification proof, Bank Details etc. Although you can get Paytm sandbox credential without complete this process. But for production you have to provide all require information.

paytm sandbox access

After this you will get Paytm Staging Credentials, which included Staging MID, Merchant Key, Industry Type, Website Name and Channel ID. Paytm also send testing wallet details, which you can use for test transaction flow.

Step 2 : Download Official Paytm PHP Kit

Paytm official announced library source code in all language. Just download Paytm Payment Gateway kit in PHP from GitHub. Extract the Zip file, their is ‘PaytmKit’ folder which has all require files.

Step 3: Configure Paytm Credential

Open ‘config_paytm.php’ file in PaytmKit -> lib folder and update with the access credential you got from Paytm.

By default source code ready for staging site. When you want to move to Production update the ‘PAYTM_ENVIRONMENT’ value by ‘PROD’.

Step 4: Create HTML Payment Form

After configure the credential, your code is ready to process. Now create an HTML form to make the online transactions.

payment gateway html form

Form action should be to this file ‘pgRedirect.php’ inside PaytmKit folder. This file handle checksum and other require details and redirect to you Paytm payment page. After click on checkout button user can process the payment via the paytm wallet.

In this form we are sending some required parameter as hidden variable like Channel ID, Industry Type and Customer ID. You have to pass these parameters along with form submit.

You May Also Like:

Code to Use Paypal Payment Gateway on Website
How to Integrate Dwolla Payment Gateway in Website
How to Integrate Barclaycard EPDQ Payment Gateway

For more information, visit Paytm official documentation and do changes as per your requirement. Using above steps you can easily did the Paytm Payment Gateway Integration in PHP. We hope this tutorial help you. Thanks

Leave a Comment