#nomercys-metadata
1 messages · Page 1 of 1 (latest)
You are putting metadata top-level on the Session so if you listen to checkout.session.completed the metadata will 100% be there.
that is exactly what i am listening to
Can you show me an event id evt_123?
how do i do that?)
Your code is processing events right now and you say "oh metadata isn't here" so I'm just asking for you to provide me an example id of such an Event your code is processing that you have looked at. So I just need you to share one of those evt_1234567
ayo, chill
so i have an id here, which starts with cs_test
is this the one you need or no?
okay so cs_test_a1E9yPIRqDd3ks2ZdynVzI6u7Hskl4OzxSJvBKqbEaqQWH56fxGgtYgp19 is the ID of your Checkout Session
yeah
that's what you create via the API in the first part of the code
exactly
oh dude, i just checked it again
the metadata is in there
i have no clue what i changed, i literally did nothing
https://dashboard.stripe.com/test/logs/req_rTnZ63RMd5Aw54 this is the API request that created the Session
and yeah no metadata there
I don't know what that means "when I do the whole thing through the site"
by that i mean that i attempted to place the order not through the terminal but my website
Hard to say. Your code is not passing metadata on creation right now at least. If you add logs to the code that runs this you should be able to confirm quickly
it is very weird, but check this other event id cs_test_a1PhaJ5q6j0HvWNIkObEbQorvVMpuyp3nICl68KCj5qTOZ066j4Vp59cAy
just to repeat, this is a Checkout Session id, it is not the Event id. The Event id is evt_123 for the checkout.session.completed event
that one has metadata which you can easily see on the creation request: https://dashboard.stripe.com/test/logs/req_L9hDDiUtFCAo27
Do you use the same code in both cases?
hmmmm wait, the one with metadata is from Node.js the one without is from the Stripe CLI
are you sure you didn't mix up your ids?
Yeah, that is what i tried to said, i figured out that the one from Stripe CLI doesn't output anymetadata, but the one from Node.JS does
that was my bad i didn't figure it out before writing here
anyways, how can i get the ordered product_id?
The Product id is associated with each LineItem associated with a Checkout Session
The problem is that line_items is not returned by default, it's what we call an includable property where you have to explicitly request it in the API, so it's never in the Event itself
You basically have to request it via the API as documented here https://stripe.com/docs/expand#includable-properties
so when you get the event in your handler, you have to explicitly retrieve that Session and get the line item(s) to access the related product(s)
cc @snow moss who is taking over for me