#lukez_webhooks

1 messages ¡ Page 1 of 1 (latest)

zenith boltBOT
#

👋 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/1287657603090092053

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

ocean flower
#

Hi there, it really depends. For example, if a checkout session is completed with a ACH direct debit payment, you'll receive a checkout.session.completed event immediately, but you may receive a payment_intent_succeeded event a few days later when ACH network informs Stripe the payment result

drifting solstice
#

okay and what about charge.succeeded?

ocean flower
#

In this case, it'll be fired at the same time as payment_intent.succeeded

drifting solstice
#

ah okay.

#

because this is what the code uses I'm using.

#

So it is recommended to show the user a "charge pending" state as long as no charge.succeeded event is received. Right?

ocean flower
#

What do you want to achieve?

drifting solstice
#

a subscription for my Discord bot. And I create checkout sessions with metadata for identification and receive the events via webhook.

As far as I've understood it, I get checkout.session.completed when the user finishes the checkout session and a charge.succeeded event later.

ocean flower
#

That's for payment method that can be confirmed immediately (i.e., card)

drifting solstice
#

what do you mean by that and what are you referring to?

ocean flower
#

OK, the payment result of some payment method (like card) can be confirmed immediately, and that's why you receives checkout.session.completed and charge.succeeded almost at the same time.

drifting solstice
#

oh

#

so I should listen to payment_intent.succeeded instead to verify that a user has definitely paid an amount?

ocean flower
#

Either payment_intent.succeeded or charge.succeeded

drifting solstice
#

oh okay

#

oh, btw. I'm not working with payment intents, I'm just working with checkout sessions. So I think I'll stick to charge.succeeded

#

As far as I understand, a payment intent is usually used when working with a front-end website or when having one-time charges with varying amounts, but I'm using pre-defined products.

#

Am I right here?

ocean flower
#

Under the hood, the checkout session automatically creates a payment_intent, and payment_intent creates a charge object, that's why you receive charge.succeeded and payment_intent.succeeded events

drifting solstice
#

ooh okay!

#

noted