Payment payload encryption. HELP.

"I am trying to integrate payment to my react-native app but the payment handler wants me to encrypt my payment data encrypt before the payment can be sent to them for processing.

Message on their site:

function encrypt(key, text) {
var forge = require(“node-forge”);
var cipher = forge.cipher.createCipher(
“3DES-ECB”,
forge.util.createBuffer(key)
);
cipher.start({ iv: “” });
cipher.update(forge.util.createBuffer(text, “utf-8”));
cipher.finish();
var encrypted = cipher.output;
return forge.util.encode64(encrypted.getBytes());
}

PLEASE IDEA OR TUTORIAL ABOUT THIS?"

Looks like you need to execute the function they have displayed on their website before sending the payload.

For that, as is apparent from the given code snippet, you need to download the package node-forge from npm.

Then write this function in your js file, and pass a key and text as parameters. The text is the payload you want to encrypt.

Then take the data returned from the last line of the function and send it to the external payment service that you’re using.