#tungtn1099
1 messages · Page 1 of 1 (latest)
What property and what webhook event are you listening to?
public async stripeEventHandler(req: Request, body: Buffer): Promise<void> {
const event = await StripeClient.getInstance().getStripeEvent(req, body);
if (!event) throw new HttpException(404, HttpMessages._NOT_FOUND);
switch (event.type) {
case 'checkout.session.completed': {
const checkoutDetails = event.data.object;
console.log(checkoutDetails.id);
break;
}
default: {
break;
}
}
}
and ts tells me
What library are you using?
I'm using Stripe.constructEvent
You mean stripe.webhooks.constructEvent?
yep yep
OK, cast the checkoutDetails to any
any works, but is there another way to cast it
You can also cast it to Session if you want