I'm trying to generate checksum for paytm integration in my app.
So, i downloaded https://github.com/Paytm-Payments/Paytm_App_Checksum_Kit_NodeJs the github repository.
Then on my server side, I created a folder name "paytm_mobile" in which the uploaded structure looks like below.
Then I updated the file "paytm_config" inside "paytm" folder with my details
module.exports = {
paytm_config: {
MID: 'V******************3',
WEBSITE: 'WEBSTAGING',
CHANNEL_ID: 'WAP',
INDUSTRY_TYPE_ID: 'Retail',
MERCHANT_KEY : '0Un**********y3R'
}
}
Then, as per the steps provided in the above link which is
I tried to call "yoursite/generate_checksum" as per step 3 on click of a button on my app like below.
exports.generate_cheksum = function(){
console.log("generate_cheksum");
const httpModule = require("http");
httpModule.request({
url: "http://www.vis******ma.com/paytm_mobile/index.js",
method: "GET"
}).then((response) => {
console.log(response); //[object Object]
response.map(key=>console.log(key)); //not getting anything
}, (e) => {
console.log("----error");
console.log(e);
});
}
But one thing I didn't get is how to call this "generate_checksum".
write this php file anywhere on server ex: generate_checksum.php
<?php
require_once("encdec_paytm.php");
define("merchantMid", "V******************3");
// Key in your staging and production MID available in your dashboard
define("merchantKey", "0**************R");
// Key in your staging and production merchant key available in your dashboard
define("orderId", "order1");
define("channelId", "WEB");
define("custId", "cust123");
define("mobileNo", "7777777777");
define("email", "username@emailprovider.com");
define("txnAmount", "100.12");
define("website", "WEBSTAGING");
// This is the staging value. Production value is available in your dashboard
define("industryTypeId", "Retail");
// This is the staging value. Production value is available in your dashboard
define("callbackUrl", "https://<Merchant_Response_URL>");
$paytmParams = array();
$paytmParams["MID"] = merchantMid;
$paytmParams["ORDER_ID"] = orderId;
$paytmParams["CUST_ID"] = custId;
$paytmParams["MOBILE_NO"] = mobileNo;
$paytmParams["EMAIL"] = email;
$paytmParams["CHANNEL_ID"] = channelId;
$paytmParams["TXN_AMOUNT"] = txnAmount;
$paytmParams["WEBSITE"] = website;
$paytmParams["INDUSTRY_TYPE_ID"] = industryTypeId;
$paytmParams["CALLBACK_URL"] = callbackUrl;
$paytmChecksum = getChecksumFromArray($paytmParams, merchantKey);
$transactionURL = "https://securegw-stage.paytm.in/theia/processTransaction";
// $transactionURL = "https://securegw.paytm.in/theia/processTransaction"; // for production
echo $paytmChecksum;
?>
add this file "require_once("encdec_paytm.php");" in same folder from this link
https://github.com/Paytm-Payments/Paytm_App_Checksum_Kit_PHP/blob/master/lib/encdec_paytm.php
passing required fields to php file is left to you. u need to give your mid and mkey there.