Thursday 26 March 2020

Create a nodejs function to take parameters and post them to a url like form-data

I am trying to create a NodeJs SDK for my hosted payment gateway. So I want to create a function that takes the necessary parameters and then POST it to the gateway's URL based on the environment. I have almost completed everything but the problem is I can't figure out how to redirect the req such that it also POST's the parameters and what to return in that case.My basic question is that if we handle a request and my method is being used then what should I return in my method definition and what should I write after my req.const mylib = require('mylib'); app.get('/', (req,res)=>{ mylib.createTransaction(txnId, amount, firstName redirectUrl, hash,function(error, response, context) { //what should I write here or in my method definition to redirect this req to a URL and end not await for res. }); });

Submitted March 26, 2020 at 08:04PM by umernaeem217

No comments:

Post a Comment