Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stripe webhook how to get f.... product ID or NAME or something data which help me identify what exact user bought

In payment_intent.succeeded I got a lot useless data, BUT CAN NOT FIND JUST ID OF PRODUCT USER BUY. This is obviously what 90% devs need, why can't this be added instead of a bunch of unnecessary information ????????????

like image 226
Руслан Миров Avatar asked Oct 20 '25 03:10

Руслан Миров


1 Answers

PaymentIntents weren't designed to work with Prices/Products, they are a "lower level" object intended to create a payment for an "amount".

You are likely using Stripe Checkout for one time payments which does work with Products/Prices. Checkout generates a PaymentIntent under the hood to facilitate the payment. The Product or Price details won't be obtained from the payment_intent.succeeded event but rather, from the checkout.session.completed webhook event.

When you receive that event, you need to retrieve the Checkout Session object and "expand" the line_items field to obtain all the line items passed to Checkout and the underlying Prices and Products by passing expand: ["line_items.data.price.product"]

like image 127
hmunoz Avatar answered Oct 24 '25 07:10

hmunoz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!