Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
app.post('/payment', async function (req, res) {
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');
res.setHeader('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');
try {
if (req.method == "OPTIONS") {
res.json("");
return;
}
var paymentReq = req.body;
var result = await makePayment(paymentReq);
res.json(result);
} catch(e) {
console.log(e);
res.status(500).json(e.toString());
}
});