#eloy-muniz_webhooks

1 messages ¡ Page 1 of 1 (latest)

ocean echoBOT
#

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

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

honest zincBOT
weary marten
#

Sorry i mean payment_intent_sucessed

marsh sparrow
weary marten
#

succeeded*

marsh sparrow
#

Event order isn't guaranteed

#

Is this a subscription checkout session or one-time payment?

weary marten
#

one-time

#

Another question: Where can I get the product ID? I need to differentiate one product from another.

#

after the customer purchases the product.

marsh sparrow
#

If it's one-time then you'll need to get it from the checkout session. So when you receive payment_intent.succeeded, you can list checkout sessions by that payment intent id: https://docs.stripe.com/api/checkout/sessions/list#list_checkout_sessions-payment_intent. You'll need to expand: https://docs.stripe.com/expand the line_items param since it isn't expanded by default: https://docs.stripe.com/api/checkout/sessions/object#checkout_session_object-line_items. It'll be in there. You could also listen for checkout_session.completed, but you'd need to make a retrieve checkout session api call anyway when listening to that event since line_items wouldn't be expanded. So, I just recommend listening to payment_intent.succeeded

Learn how to reduce the number of requests you make to the Stripe API by expanding objects in responses.

weary marten
#

Cool!And about my last question

#

"Where can I get the product ID? I need to differentiate one product from another.
after the customer purchases the product."

marsh sparrow
#

That's what my above response is

#

It's within line_items

weary marten
#

ah ok

marsh sparrow
weary marten
#

My last question: Can I place metadata within the payment_intent_succeeded object? If so, where do I put it?