FROM THE CLIENT SIDE, I CAN'T SEND A POST REQUEST!
I must use the Node js Rest API to deliver an HTTP Post request to the payment gateway. Headers and a body payload are required for a post request. I use a Rest API with Express.js and have my frontend and backend separated. Since the payment gateway requires server-to-server connection, I am unable to implement that from the client side. Basically, I have to call my backend server when a user hits the "Payment" button, and then my backend server has to make a request to the payment gateway.
The only MVC (Model View Controller) documentation available for payment gateways is not very helpful.
Consequently, the controller's logic should look like this.
exports.payment = (req, res, next) => {
const { amount, id, currency } = req.body;
//add headers
//create body paloyad
//send request to https://payment....com/api-key/transaction
//receive response
res.status(200).json({ status: 'success' });
}