Saturday, September 29 2018
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_ENVIRONMENT', 'TEST'); // PROD 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_REFUND_URL', 'https://'.$PAYTM_DOMAIN.'/oltp/HANDLER_INTERNAL/REFUND'); define('PAYTM_STATUS_QUERY_URL', 'https://'.$PAYTM_DOMAIN.'/oltp/HANDLER_INTERNAL/TXNSTATUS'); 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
For Wallet Credentials:
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.