#vinnedev
1 messages · Page 1 of 1 (latest)
When you have the Product Id, you can get the Price Id, then you can look at if its a recurring Price or not
Recurring Price means Subscription
Can I get this information in the events that are sent from Stripe to my webhook?
So, I thought about, storing the stripe products and subscriptions in my database with some information, such as: name of the product/subscription, prod_id..., value and the amount of credit that should go to the customer, what What I think about is receiving an event from Stripe that tells me the ID of the product that was purchased to search the database and give credit to my client, in this case the events that Stripe itself returns to us in the webhook
Hi @dusk narwhal I'm taking over this thread
I'm great, thanks for asking.
🙂
So you want to retrieve the product ID from a checkout.session.completed event, am I right?
Yes, it doesn't necessarily have to be at this specific event, but somewhere where I can retrieve this information
The product IDs that you are looking for are included in the CheckoutSession object's line_items (https://docs.stripe.com/api/checkout/sessions/object#checkout_session_object-line_items) , you need to expand ( https://docs.stripe.com/api/expanding_objects) and access it. In your webhook code that handles checkout.session.complete events, you should retrieve the Checkout Session with ['line_items.price'] expanded, so that you can obtain the list of prices/products in the line_item list. Check this guide https://docs.stripe.com/payments/checkout/fulfill-orders?lang=ruby#fulfill for more about how to fulfill orders with Checkout.
I don't know if checkout.session.completed would have this information, it's below:
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.