#mboras_webhooks

1 messages ¡ Page 1 of 1 (latest)

astral karmaBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1357634137946853530

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

digital gate
#

hi there!

#

if you are using Checkout Session, then yes checkout.session.completed is the correct event

obtuse cloak
#

one more question please

#

what type is request object that I am receiving in my webhook for checkout.session.completed (typescript) and I am using package stripe

digital gate
#

you will get a Checkout Session object in the payload.

obtuse cloak
#

yeah I am getting it all good, but I am asking does Stripe package have some predefined type in typescript that I can use

#

I think I've found it

#

import Stripe from "stripe";

type CheckoutSession = Stripe.Checkout.Session;
type StripeEvent = Stripe.Event;

...

const body = (await req.json()) as StripeEvent;

const session = body.data.object as CheckoutSession;
console.log("Checkout session completed:", session);

console.log("Complete Stripe webhook object:", JSON.stringify(body));
#

I think this'll be it

digital gate
#

yes that looks right!

obtuse cloak
#

tnx @digital gate very much