#nomercys-metadata

1 messages · Page 1 of 1 (latest)

sly carbon
#

You are putting metadata top-level on the Session so if you listen to checkout.session.completed the metadata will 100% be there.

vale granite
#

that is exactly what i am listening to

sly carbon
#

Can you show me an event id evt_123?

vale granite
#

how do i do that?)

sly carbon
#

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

vale granite
#

ayo, chill

#

so i have an id here, which starts with cs_test

#

is this the one you need or no?

sly carbon
#

okay so cs_test_a1E9yPIRqDd3ks2ZdynVzI6u7Hskl4OzxSJvBKqbEaqQWH56fxGgtYgp19 is the ID of your Checkout Session

vale granite
#

yeah

sly carbon
#

that's what you create via the API in the first part of the code

vale granite
#

exactly

#

oh dude, i just checked it again

#

the metadata is in there

#

i have no clue what i changed, i literally did nothing

sly carbon
#

and yeah no metadata there

vale granite
#

i mean, i have it when i do the whole thing through the site

sly carbon
#

I don't know what that means "when I do the whole thing through the site"

vale granite
#

by that i mean that i attempted to place the order not through the terminal but my website

sly carbon
#

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

vale granite
#

it is very weird, but check this other event id cs_test_a1PhaJ5q6j0HvWNIkObEbQorvVMpuyp3nICl68KCj5qTOZ066j4Vp59cAy

sly carbon
#

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

#

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?

vale granite
#

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?

sly carbon
#

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

#

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