'React JS : CCAvenue Payment Integration
I want to integrate CC Avenue Payment gateway in my React JS 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.
Below is the code i have tried.
I have installed Node CCAvenue plugin.
const nodeCCAvenue = require('node-ccavenue');
const ccav = new nodeCCAvenue.Configure({
merchant_id: XXXXXXX,
working_key: XXXXXXXXXXXXXX,
});
const orderParams = {
order_id: 123456,
currency: 'INR',
amount: '100',
redirect_url: encodeURIComponent(`URL`),
billing_name: 'John Doe',
// etc etc
};
const encryptedOrderData = ccav.getEncryptedOrder(orderParams);
what URL should I put in redirect_url so that it can open Payment window.
Any help would be great.
Thank You.
Solution 1:[1]
I'm the author of the node-ccavenue module so I think can answer this.
Don't use the node-ccavenue package on your client side with React. The module uses Node.js' crypto library to encode and decode order information. Additionally, you cannot expose your merchant_id or working_key by putting them in clientside scripts.
Use this in your backend code if your backend is written with Node.js and return the encryptedOrderData to the frontend via an api endpoint
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Meet Dave |
