问题
I have received the merchant id test api key from Ccavenue i just want to know how i can integrate Ccavenue with angular Js website. Screens required
回答1:
For Angular 2+, You may check this article https://medium.com/@daveinside/integrating-ccavenue-in-node-js-angular-5-b9de44091062
I wrote this answer as there is a lack of help for Angular 2+ based CCAvenue Integration. Good Luck!
回答2:
1) You can use non-seamless integration from integration kit(ccavenue provides it for different framework line)
2) At server create "encRequest" (encrypted form values using working key) and send to client along with accessCode
3) In your angular controller call your API which will return encRequest and accessCode
4) Once you get encRequest and accessCode follow following code
app.controller("changeProfileController", function($scope, $http, $sce){
$scope.myText = ""; // ng-model for html response container in view
$scope.ProfileData = {
//custom and required data fields
};
$http({
method: 'POST',
url: '/requestPaymentAPI',
processData: false,
data: JSON.stringify($scope.ProfileData)
}).then(function(res){
$scope.myText = $sce.trustAsHtml('<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="'+ res.data.accessCode.trim() +'" style="display:none;" ><input type="text" id="encRequest" name="encRequest" value="'+ res.data.encRequest.trim() +'" style="display:none;" ><script language="javascript">document.redirect.submit();</script></form>');
},function errorCallback(err){
console.log(err);
});
});
5) In your view add div in which you can render the html
<div class="ccavenueResponse">{{ myText }}</div>
6) It will redirect you to payment gateway form and after processing transaction it will return response string which you can process(decrypt the encrypted data of ccavenue response) at server side and display that data using URL based routes of that data
来源:https://stackoverflow.com/questions/36626353/ccavenue-integration-with-angular-js