12 Oct, 2017

How we can integrate Paytm payment gateway using PHP

12 Oct, 2017

Dear Reader, very pleased to make you understand about “Paytm Payment Gateway Integration using PHP” as Paytm is an Indian Payment Gateway having too much growth in very few years of its birth. PayTM stands for “Payment Through Mobile”. It’s headquarters is in Noida, Uttar Pradesh, India, established by Mr. Vijay Shekhar Sharma in August 2010.

As all types of payment gateways, it is also very easy to integrate in your website. And we are very sure that you will get this by following these very simple steps. So here we go…

Before following these steps, please go through our Paytm Payment Gateway Integration demo Video.

1. At first Download Paytm Web Sample Kit.

2. Copy PaytmKit folder in document root of your server (like /var/www/html).

3. Open config_paytm.php file from the PaytmKit/lib folder and update the below constant values of config_paytm.php.

These keys are defined as:-
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

4. 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 properly.


Here you may need to change the value of CUST_ID from CUST001 to CUST501 or any other than CUST001 for the testing scenario if you will get the issues in the testing environment.

5. You may also need to add 8th parameter “CALLBACK_URL” in pgRedirect.php under

And after that, you can get your proper result.

Congratulations you have successfully learned “How we can integrate Paytm payment gateway using 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



  • niru July 14, 2018

    i think this demo is not working please help me to done paytm integrated in my codeignitor site.


    • Webpreparations Team July 17, 2018

      Dear Reader,
      This code is perfectly working in Core PHP, but for running in Codeigniter, you have to follow the rules of CodeIgniter, means Controller, Model, View structures. Thank you for your comments, we will update you about Paytm Integration in CodeIgniter shortly for sure…


    • Webpreparations Team December 01, 2018

      Dear Reader, I think you should change the value of CUST_ID from CUST001 to CUST501 or any other than CUST001 for the testing scenario. I hope this will resolve your issue. If still persists problem, then please send your code. We will resolve for sure.Thanks for your precious comments.


  • satendra shukla November 26, 2018

    Your paytm demo is not working, on your website. please check this and solve erreor


    • Webpreparations Team December 01, 2018

      Dear Reader, have you changed CUST_ID from CUST001 to CUST501 or any other than CUST001. ? Please change that for testing purpose. If still you will get the error, then please send your code, we will help for sure.


  • swroop January 05, 2019

    Your code is not working it was saying checksum mismatch kindly resolve this


    • Webpreparations Team January 13, 2019

      Dear Reader, Please check our Video Update in this post. And you will see , that CheckSum has been matched. Hence please follow proper steps. And if you will be satisfied, then please write positive comments for us, Thank you 🙂


  • Deepak January 16, 2019

    Please say what to do when the page says “checksum is mismatched” when i use paytm environment in “PROD” mode.


    • Webpreparations Team January 20, 2019

      define(‘PAYTM_ENVIRONMENT’, ‘PROD’); // Use PAYTM_ENVIRONMENT as ‘PROD’ if you wanted to do transaction in production environment else

      define(‘PAYTM_ENVIRONMENT’, ‘TEST’); // ‘TEST’ for doing transaction in testing environment.
      define(‘PAYTM_MERCHANT_KEY’, ‘bKMfNxPPf_QdZppa’); //Change this constant’s value with Merchant key downloaded from portal
      define(‘PAYTM_MERCHANT_MID’, ‘DIY12386817555501617’); //Change this constant’s value with MID (Merchant ID) received from Paytm
      define(‘PAYTM_MERCHANT_WEBSITE’, ‘DIYtestingweb’); //Change this constant’s value with Website name received from Paytm

      Please use original keys from Paytm Website and then check for Production Environment.
      As above written keys are for Testing Environment only.


Leave a comment:

Your email address will not be published. Required fields are marked *