我正在尝试为我的应用程序中的paytm集成生成校验和。
因此,我下载了https://github.com/Paytm-Payments/Paytm_App_Checksum_Kit_NodeJs github存储库。
然后,在服务器端,我创建了一个名为“ paytm_mobile”的文件夹,其上载结构如下所示。
然后,用我的详细信息更新了“ paytm”文件夹中的文件“ paytm_config”
module.exports = {
paytm_config: {
MID: 'V******************3',
WEBSITE: 'WEBSTAGING',
CHANNEL_ID: 'WAP',
INDUSTRY_TYPE_ID: 'Retail',
MERCHANT_KEY : '0Un**********y3R'
}
}
然后,按照上述链接中提供的步骤
在我的应用程序上单击一个按钮时,我尝试按照步骤3调用“您的/ generate_checksum”。
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);
});
}
但是我没有得到的一件事是如何称呼它为“ generate_checksum”。
答案 0 :(得分:1)
在服务器ex上的任何位置将此php文件写入: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;
?>
添加此文件“ require_once(“ encdec_paytm.php”);“在此链接的同一文件夹中
https://github.com/Paytm-Payments/Paytm_App_Checksum_Kit_PHP/blob/master/lib/encdec_paytm.php
将必填字段传递到php文件的操作留给您。您需要在那儿给您的琴键和琴键。