In this article we have explained about How to Integrate Paytm Payment Gateway in PHP.  Paytm payment gateway is a easy to integrate with PHP. In many peoples are using Paytm in India. Paytm is a famous for online transaction in India.

See our demo video on Youtube:

Step 1:

First create a merchant account in Paytm

Step 2:

Get your sandbox and live credentials.


Step 3:

Download Paytm payment gateway kit for integration. Click here to download paytm script php


Step 4:

Update your sandbox keys in lib/config_paytm.php

define('PAYTM_MERCHANT_KEY', 'xxxxxxxxxxxxxxxxx'); //Change this constant's value with Merchant key downloaded from portal
define('PAYTM_MERCHANT_MID', 'xxxxxxxxxxxxxxxxx'); //Change this constant's value with MID (Merchant ID) received from Paytm
define('PAYTM_MERCHANT_WEBSITE', 'WEB_STAGING'); //Change this constant's value with Website name received from Paytm

Paytm for website use WEB_STAGING 

Paytm for Mobile App use APP_STAGING

Enable below codes in config_paytm.php

define('PAYTM_STATUS_QUERY_NEW_URL', 'https://'.$PAYTM_DOMAIN.'/oltp/HANDLER_INTERNAL/getTxnStatus');
define('PAYTM_TXN_URL', 'https://'.$PAYTM_DOMAIN.'/oltp-web/processTransaction');
Step 5:

Set callback url in pgRedirect.php

$paramList["CALLBACK_URL"] = "http://localhost/paytm/PaytmKit/pgResponse.php";

Step 6:

Basic form available in TxnTest.php. Here we can send amount and other custom parameters to Paytm payment process.


Step 7:

Checkout the form.


Step 8:

Paytm Test Credentials

For Credit card/Debit card Credentials

  • Card Number -: Any valid VISA or MASTER card number
  • Expiry Date-: Any future date from transaction date
  • CVV-: Any three digit number
  • OTP-: 123123 (To test successful transaction)

For Wallet Credentials:

  • Mobile Number – 7777777777
  • Password – Paytm12345
  • OTP – 489871
  • After every 5 minutes, the Wallet balance is topped up to Rs. 7,000

Step 9:

In response page you will receive Paytm Txn ID then you can that transaction status in TxnStatus.php

Thanks for reading this article. If you have any queries and please comment in the below.

Share Your Thoughts

Inline Feedbacks
View all comments
Subscribe Our Channel

Email Subscription
Watch Tutorials
Copyright © 2015 - 2021 PHPEXPERTISE.COM