#omar-line_items
1 messages · Page 1 of 1 (latest)
hi there! no you can't expand the webhook response. Can you share a Checkout Session id so that i can take a closer look at how you integrate?
thanks Alex
session_id=cs_test_a1KVH5yAilnNi6wDmRi4roPBJrY1Bj3fTOZzyUd1o1dTNjC9QRrVeUbiPZ
if you want the PaymentIntent data, you can listen for it via the webhook also
i.e. the payment_intent.succeeded event
yea but im getting that response of payment intent and it does not include line items either
ah okay, so you want the line_items specifically.
to clarify, are you going to create a Checkout Session each time or are you using Payment Links?
checkout each time i think
hmmm, so we don't include the line_items by default in the Checkout Session object as you're well aware already. One workaround which I can think of is to include the line_item price in the metadata.
https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-metadata
or if you prefer it to also be included in the PaymentIntent, include it in https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-payment_intent_data-metadata
The metadata will be returned with the relevant events
what about the quantity tho?
how can i get the details of purchased items and their quantities programmatically? The next step depends on these details
metadata is set in the UI when you create products correct? is there a way to add the metadata in my app code?
you can pass all of those data in when your application creates the Checkout Session - https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-metadata
However, if you're going to allow adjustable quantities. Then it would make more sense for you to retrieve the Checkout Session once you've received the checkout.session.completed session and expand the line_items to receive that information in the response
like here