gpt4 book ai didi

node.js - 与接受 INR 的 nodejs 一起使用的支付网关

转载 作者:搜寻专家 更新时间:2023-10-31 23:54:16 26 4
gpt4 key购买 nike

我正在寻找支持 INR 的支付网关,我可以将其与 nodejs 应用程序一起使用。找不到任何有用的东西。任何建议和指示都会有所帮助。

最佳答案

我认为 citruspay 是一个不错的选择。以下链接显示了与 Node js 的集成。

Merchant Hosted Checkout (Citrus.js)

 var crypto = require('crypto');
function generateSignature(merchantTxnId, request) {
//Need to change with your Secret Key
var secret_key = "***SEcRETKey***";

//Need to change with your Access Key
var accesskey = "***Access Key***";

//Should be unique for every transaction
var txn_id = merchantTxnId;

//Need to change with your Order Amount
var amount = "1.00";
var data = 'merchantAccessKey=' + accesskey + '&transactionId=' + txn_id + '&amount=' + amount;

// generate hmac
var hmac = crypto.createHmac('sha1', secret_key);
hmac.update(data);
return hmac.digest('hex');
}

现在在 PaymentObject 中包含这个签名

Then listen for post on the Return URL You have to generate signature and compare with the signature sent in the post data from citrus to make sure data is not tampered in the way.

 var http = require("http");
var qs = require('querystring');
var crypto = require('crypto');
var secret_key = "MERCHANT_SECRET_KEY";

http.createServer(function(request, response) {
var body = "";

if (request.method = "POST") {
request.on("data", function(data) { body += data; });
request.on("end", function() {
var post = qs.parse(body);

var data_string = post['TxId'] + post['TxStatus'] + post['amount']
+ post['pgTxnNo'] + post['issuerRefNo'] + post['authIdCode']
+ post['firstName'] + post['lastName'] + post['pgRespCode']
+ post['addressZip'];

var signature = crypto.createHmac('sha1',
secret_key).update(data_string).digest('hex');

if (signature == post['signature']) {
response.writeHead(200, {"Content-Type": "application/json"});
console.log(post);
response.write(JSON.stringify(post));
}
else {
response.writeHead(403, {"Content-Type": "application/json"});
var error = {error : 'Transaction Failed', message: 'Signature Verification Failed'};
response.write(JSON.stringify(error));
}

response.end();
});
}
}).listen(3000);

关于node.js - 与接受 INR 的 nodejs 一起使用的支付网关,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28778651/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com