Please how can I go about this
I'm trying to add billing details in which I'll get the user address from my front end
This my payment route
router.post("/pay", verifyToken, (req, res) => {
console.log(req,res)
let totalPrice = Math.round(req.body.totalPrice * 100);
stripe.customers
.create({
email: req.decoded.email
})
.then(customer => {
return stripe.customers.createSource(customer.id, {
source: "tok_visa"
});
})
.then(source => {
return stripe.charges.create(
{
amount: totalPrice,
currency: "usd",
customer: source.customer,
email: req.body.email
},
})
.then(async charge => {
console.log("charge>", charge);
})
.catch(err => {
res.status(500).json({
success: false,
message: err.message
});
});
});