Added email to stripe checkout session
continuous-integration/drone/push Build is passing Details

main
Filip Borum Poulsen 3 years ago
parent 7fd8a0419b
commit 38a34b3c56

@ -136,6 +136,14 @@ router.post("/order", UserAuth, async (req: AuthedRequest, res: Response) => {
type: "startDate.invalid"
}]);
const emailQuery = await client.query(`
SELECT email FROM users WHERE id = $1;
`, [
req.user?.userId
]);
const email: string = emailQuery.rows[0].email;
const priceQuery = await client.query(`
SELECT hourly_price FROM trainers WHERE id = $1;
`, [
@ -167,7 +175,8 @@ router.post("/order", UserAuth, async (req: AuthedRequest, res: Response) => {
expires_at: Math.floor(Date.now()/1000 + 60*31),
mode: 'payment',
success_url: `http://localhost:5173/orders`,
cancel_url: `http://localhost:5173`
cancel_url: `http://localhost:5173`,
customer_email: email
});
const insertQuery = await client.query(`

Loading…
Cancel
Save