'React Native how to integrate CCAvenue Payment gateway

var ccavenue = require('ccavenue');

//required
ccavenue.setMerchant("Merchant Id");
ccavenue.setWorkingKey("Working Key");
ccavenue.setOrderId("Order Id");
ccavenue.setRedirectUrl("Redirect Url");
ccavenue.setOrderAmount("Order Amount");


You can also send customer info (Optional).

var param = {
  billing_cust_address: 'Bangalore', 
  billing_cust_name: 'Nitish Kumar'
};
ccavenue.setOtherParams(param); //Set Customer Info


For more detail 
https://world.ccavenue.com/downloads/CCAVenueWorldIntegrationManual.pdf


// Server url where you want to send data to ccavenue
server.get('/make-payment', function(req, res) {
  ccavenue.makePayment(res); // It will redirect to ccavenue payment
});

// Server url should be as redirect url (which you are passing as Redirect Url).
server.post('/redirect-url', function response(req, res) {
  var data = ccavenue.paymentRedirect(req); //It will get response from ccavenue payment.

  if(data.isCheckSumValid == true && data.AuthDesc == 'Y') {
      // Success
      // Your code
  } else if(data.isCheckSumValid == true && data.AuthDesc == 'N') {
      // Unuccessful
      // Your code
  } elseif(data.isCheckSumValid == true && data.AuthDesc == 'B') {
      // Batch processing mode
      // Your code
  } else {
      // Illegal access
      // Your code
  }
});

I want to integrate CC Avenue Payment gateway in my React Native Application. When I click on Payment button, it should open CC Avenue payment window to make payment and after successful of payment , I want to get its response and redirect to thankyou page.

I took above code from here https://github.com/nitishk1316/node-ccavenue

Note: I want to integrate it inside my application but this documentation does not have any import and proper step by step process to implement. How can I integrate CCAvenue payment in my React Native application?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source