#Pdot-checkout-custom-field

1 messages ยท Page 1 of 1 (latest)

sudden cargo
#

Hello ๐Ÿ‘‹
I'm not sure off the top of my head
let me take a look ๐Ÿ™‚

stiff cosmos
#

Thank you

sudden cargo
stiff cosmos
#

yes I am already sending the items to be purchased via line_items

sudden cargo
stiff cosmos
#

my question is, if there is a field that can hold the type of product, so once I recieve it on the /success page I can perform logic based on if the product purchased had the type of "tech" or "digital tool"

#

oh actually I see there is a metadata that gets returnd in the link you just send

sudden cargo
#

yup I was going to mention just that ๐Ÿ™‚

stiff cosmos
#

so directly in the line_items array of objects, I can pass in something like this?

#

line_items = [{"name": "test", "quantity": "1", "amount": 9999, "metadata": {"type": "tech"}}]

sudden cargo
#

yup

#

that should work, yes

stiff cosmos
#

sounds good, I'll give it a go. Thanks for the help

sudden cargo
#

NP! ๐Ÿ™‚ Good luck

stiff cosmos
#

I was able to create the checkout with the metadata but upon getting to the success page and calling the session, the meta data seems to be empty.

sudden cargo
#

but that's the checkout session metadata though, you're setting metadata on the line items in the code

stiff cosmos
#

is there a way to grab the line items in the session potentially? applogies, its my first day with stripe

sudden cargo
stiff cosmos
#

thanks, let me give that a go

#

ahhh I was able to expand the session to include Line items but metadata still seems empty.

#

just making sure the metadata goes inside the product_data and not outside?

sudden cargo
#

yup I believe so. On the flip-side, I think you can also set metadata on the session object itself.

stiff cosmos
#

thank you, I am trying to save a few db calls and not place it on the session object. I would really prefer it to be on line_items. Really not sure why its not working.

sudden cargo
#

do you have a request ID for the session creation?
I can take a look

stiff cosmos
#

let me grab that

#

req_YNvOSREpaldH3k

sudden cargo
#

thanks. looking

#

ah I see what happened there
the metadata is actually linked to the product since we're basically setting it as product_data[metadata]

stiff cosmos
#

I am assuming there is a way to expand product_data lol

sudden cargo
#

you bet ๐Ÿ˜„
expand: ['line_items.data.price.product']

stiff cosmos
#

let me give it a go

#

you my friend are a big help. Thank you worked like a charm

sudden cargo
#

NP! ๐Ÿ™‚ Glad that worked

stiff cosmos
#

you have a great rest of the day