#Glutch

1 messages · Page 1 of 1 (latest)

waxen spireBOT
sacred cosmos
#

Hello! Not sure I understand, can you provide more detail?

hot tiger
#

you can provide metadata to a new session, but it would be extremely convenient to add metadata to a single line item

sacred cosmos
#

You mean a Checkout Session?

hot tiger
#

yes

sacred cosmos
#

What's your use case for wanting metadata for the line items in Checkout?

hot tiger
#

i sell customized products, where the customer uploads their own image to print

#

so adding the image to the product would be great

#

otherwise ill have to add some JSON.stringify object to the checkout metadata etc

sacred cosmos
#

Wait, the image?

#

Stripe metadata only supports strings.

hot tiger
#

Yeah, what do you mean?

hot tiger
#

JSON.stringify = string

sacred cosmos
#

You said image, which is not a string.

hot tiger
#

oh wait

#

i dont see the image provided there when using stripe.checkout.sessions.listLineItems

#

i want to use the image url in the backend for stuff

sacred cosmos
#

That's because everything inside product_data is being set on the Product created by Checkout.

#

If you want to fetch that data from the API you need to fetch the Product.

hot tiger
#

but im not creating a product here, it's just a one time product not saved

sacred cosmos
#

Data used to generate a new product object inline.

hot tiger
#

when i browse stripe -> products, it just says "add your first test product"

#

so no product is saved from stripe.checkout.sessions.create(payment_object)

sacred cosmos
#

Products created using product_data do not show up in the Dashboard.

hot tiger
#

hmm okey, how do i find them?

#

okey

#

i see

#

1 sec

sacred cosmos
#

When you create the Checkout Session expand the line_items and then you should see the Product ID in there.

hot tiger
#

nice, it worked

im currently passing the thumbnail to product_data.images: [db_item.thumbnail],

if i pass 2 images, will the source file be shown somewhere? Why can this be an array?

sacred cosmos
#

You can pass up to eight images which should show up when you fetch the Product, but I believe Checkout only uses the first image.

hot tiger
#

that's awesome

#

alright, this is great

sacred cosmos
#

It's an array because we may support more than one image in the future.

hot tiger
#

no need for metadata now

#

thanks for the help!