#ythouma-payment-links
1 messages ยท Page 1 of 1 (latest)
Hi there! You don't see the Price ID in the checkout.session.completed event?
Ah no you wouldn't
I forgot that we don't expand line items for payment links
So one way to handle this would be to attach metadata to your Payment Link
The other option is to retrieve the Checkout Session after checkout.session.completed hits your endpoint
here's the completed object, no pricing, it usullay come with the invoice succced event
Yep so you can retrieve the checkout session using https://stripe.com/docs/api/checkout/sessions/retrieve
Or if you add metadata then it will also be there
ok, let me try to get the session object
Sorry, I mispoke
Retrieving the session will give you the same thing as the checkout.session.completed event.
One sec. Let me check on best way to do this.
i was just coming to tell u that ๐
I forgot that we return different properties for a Payment Link Checkout Session versus a normal Checkout Session
Okay yeah, so the first recommendation I had is the way to go here.
You want to add metadata to your Payment Link
Referencing the Product/Price
Then that metadata will appear in your checkout.session.completed event that hits your webhook endpoint
Sorry for the confusion!
Yeah you could either use your own string or you could literally put the Price/Product IDs as metadata
Up to you
but even with that solution , i'll still be unable to get the Quantity of this product!
Are you using adjustable quantity?
Okay okay okay
I realize what I missed
So on the Checkout Session the line_items is expandable and we don't populate it unless you expand it: https://stripe.com/docs/api/checkout/sessions/object?lang=node#checkout_session_object-line_items
So you actually do want to retrieve the Checkout Session as I noted originally but then expand line_items using https://stripe.com/docs/api/expanding_objects