我是支付网关的新手。我想使用NodeJS将CCAvenue集成到我的Web应用程序中。我从npm安装了CCAvenue软件包,但我不知道付款。
如果有人向我指出除了CCAvenue集成手册之外的其他教程,我会很高兴。
答案 0 :(得分:2)
首先,我建议使用CCAvenue提供的nodejs集成套件(非无缝)
1)在UI组件中添加来自集成套件的dataForm,因为它是
2)使用ajax调用其余的api,如下所示:
app.controller("changeProfileController", function($scope, $sce){
var dataObject = $("#paymentDataForm").serializeArray();
$.ajax({
type: "POST",
url: restApiServer.ReSTFulAPIHost + '/ccavRequestHandler',
data: dataObject,
cache : false,
processData: false,
success: function (res) {
//console.log(data);
$scope.myText = $sce.trustAsHtml(res.data);
},
dataType: 'json'
});
});
3)从Integration kit调用ccAvenueRequestHandler代码,它将生成html表单,如下所示
// Use your own credentials
var workingKey = "AECGKJBBSERVFBG";
var accessCode = "ab4512vhvweb56g784433";
// formObject is data send from client
var contentArray = [];
_.each(formObject, function(value, key, data){
contentArray.push(key+"="+data[key]);
});
body = contentArray.join("&");
encRequest = ccav.encrypt(body,workingKey);
var formBody = '<form id="nonseamless" method="post" name="redirect" action="https://secure.ccavenue.com/transaction/transaction.do?command=initiateTransaction" ><input type="text" name="access_code" id="access_code" value="'+ accessCode +'" style="display:none;" ><input type="text" id="encRequest" name="encRequest" value="'+ encRequest +'" style="display:none;" ><script language="javascript">document.redirect.submit();</script></form>';
return reply(formBody);
4)因为Angularjs没有提供到另一个网址的直接路由。您必须在UI中创建一个DOM,您可以在其中呈现响应(2)中的html表单,该表单将重定向到ccavenue支付页面
// HTML Code
<div ng-bind-html='myText'></div>
5)从工具包添加ccavenueResponse处理程序以处理您的响应,从ccavenue解密数据并将用户重定向到包含响应数据的链接
var workingKey = "AECGKJBBSERVFBG", //Put in the 32-Bit key shared by CCAvenues.
ccavResponse = ccav.decrypt(request.payload.encResp,workingKey);
var strArray = ccavResponse.split("&");
var resObject = {};
for(var i=0; i< strArray.length; i++){
var tempArray = strArray[i].split("=");
resObject[tempArray[0]] = tempArray[1];
}
// resObject will contains the payment information
// You can use this data as you want
答案 1 :(得分:0)
您可以使用ccavenue
npm包