#vinnedev

1 messages · Page 1 of 1 (latest)

terse valleyBOT
upper horizon
#

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

dusk narwhal
#

Can I get this information in the events that are sent from Stripe to my webhook?

upper horizon
#

Yes I am pretty sure.

#

Which event is that?

terse valleyBOT
dusk narwhal
#

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

little moon
#

Hi @dusk narwhal I'm taking over this thread

dusk narwhal
#

Hi jack!

#

how are u?

little moon
#

I'm great, thanks for asking.

dusk narwhal
#

🙂

little moon
#

So you want to retrieve the product ID from a checkout.session.completed event, am I right?

dusk narwhal
#

Yes, it doesn't necessarily have to be at this specific event, but somewhere where I can retrieve this information

little moon
#

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.

Learn how to fulfill orders after a customer pays with Stripe Checkout or Stripe Payment Links.

dusk narwhal