#Beninate-line_items
1 messages ยท Page 1 of 1 (latest)
hello @rare lodge! Can you share the PaymentIntent id so that i can take a closer look?
pi_3Jv0nmK8IruJbDfX1f2PQG0N
alrighty, looks like you're using Checkout Sessions.
Generally, we'd recommend listening for the checkout.session.event completed webhook event, and upon receipt, retrieve the Checkout Session and expand the line_items parameter [0][1]
[0] https://stripe.com/docs/api/expanding_objects
[1] https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-line_items
The Checkout Session will also have the PaymentIntent : https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-payment_intent
mmm and i guess i can't access the CheckoutSession from the PaymentIntent?
well there must be a way ๐ค
yeah, the PaymentIntent doesn't contain a reference to the Checkout Session
it's the other way round, the Checkout Session will contain a reference to the underlying PaymentIntent
then how is this page able to show the line items? https://dashboard.stripe.com/payments/pi_3Jv0nmK8IruJbDfX1f2PQG0N ๐ง
we have some underlying logic to show that, but the header for that section mentions Checkout Summary
yep, you would want to make use of the Checkout Session to retrieve all the data you want instead
bummer... much bum...
the Checkout Session also contains the PaymentIntent though. Is there any reason you need to start with the PaymentIntent specifically?
no no, i hear you, it's just that i am needing to backfill some missing data in our DB, and to date, we've only been storing the payment_intent_id from Stripe, so that's all we have
obviously, in retrospect, it sounds like the checkout_session_id would have been the way to go, but alas it aints what i got
Retrieve the list of Checkout Sessions : https://stripe.com/docs/api/checkout/sessions/list
when retrieving the list of Checkout Sessions, remember to expand the line_items parameter so that you don't have to make an additional call
then you would need to link them up in your DB based on the PaymentIntent
does that work?
oh! Stripe::Checkout::Session.list(payment_intent: 'foo') seem to work!
yep!
great! feel free to reach out again if you have any questions ๐
Thank you Alex Stripe. what a serendipitous last name!
one more thing though
i can't call .line_items on a CheckoutSession ๐ค
the line_items parameter is not included by default [0]. You'd need to expand it.
[0] https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-line_items
yay!