I am building a mini project and I am using a Payment Processor called Paystack. Typically, when a payment is initiated by the user, the payment processor generates a unique link for that current payment transaction. All the payment processor requests are set up in the Backend, I am using NodeJS and Express basically. Now my current issue is redirecting the frontend to the payment gateway using the generated link. The code for handling that looks like this basically.
const config = {
headers: {
Accept: "application/json",
"Content-Type": "application/json",
Authorization:
"Bearer ApiKey",
},
};
try {
const res = await axios.post(
`${API_URL}/payment/paystack/pay/${ref}`,
config
);
console.log(res);
} catch (error) {
console.log(error);
}
};
The result of res is the link generated. How do I make my frontend goto the generated link?
Any help would be appreciated. Thank you.