Skip to content

Commit aaa8a2d

Browse files
author
Your Name
committed
Stripe In Practice Course
1 parent f30bed3 commit aaa8a2d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

server/checkout.route.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,21 @@ export async function createCheckoutSession(req: Request, res: Response) {
2020
userId: req["uid"]
2121
};
2222

23+
if (!info.userId) {
24+
const message = 'User must be authenticated.';
25+
console.log(message);
26+
res.status(403).json({message});
27+
return;
28+
}
29+
2330
console.log('Purchasing course with id: ', info);
2431

2532
const purchaseSession = await db.collection('purchaseSessions').doc();
2633

2734
const checkoutSessionData: any = {
2835
status: 'ongoing',
29-
created: Timestamp.now()
36+
created: Timestamp.now(),
37+
userId: info.userId
3038
};
3139

3240
if (info.courseId) {

0 commit comments

Comments
 (0)