#tungtn1099

1 messages · Page 1 of 1 (latest)

digital pumiceBOT
delicate swift
#

What property and what webhook event are you listening to?

tribal gate
#
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

delicate swift
#

What library are you using?

tribal gate
#

I'm using Stripe.constructEvent

delicate swift
#

You mean stripe.webhooks.constructEvent?

tribal gate
delicate swift
#

OK, cast the checkoutDetails to any

tribal gate
#

any works, but is there another way to cast it

delicate swift
#

You can also cast it to Session if you want