How do I send and retrieve extra data like size in a checkout session?
I have tried sending metadata but the checkout session throws an unsupported error.
Also, using Orders Api, is there a way to generate an order ID that can be update by the checkout.session.completed webhook? That way I could send purchased items with all the info I need, description, size, amount etc.
I may be off track, but not finding away to resolve the issue of sending/retrieving additional data.
Use metadata on the Checkout Session. I'm not sure why you got an error since Checkout Sessions do support metadata.
Use the Products and Prices you pass in line_items to infer data about the goods sold. For instance if you sell T-shirts in 3 different sizes, you'd have a Product for each size (small, medium, large) and a Price for each size describing how much you charge for each. This way when you expand the line_items property you'd be able to infer data like description, size and amount via the Product and Price objects.
If you're still having trouble I recommend jumping into our official Discord where Stripe engineers hang out and help you with your questions!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi Paul,
Great article, thank you.
How do I send and retrieve extra data like size in a checkout session?
I have tried sending metadata but the checkout session throws an unsupported error.
Also, using Orders Api, is there a way to generate an order ID that can be update by the checkout.session.completed webhook? That way I could send purchased items with all the info I need, description, size, amount etc.
I may be off track, but not finding away to resolve the issue of sending/retrieving additional data.
Thanks
Michael.
You have two options here:
Use metadata on the Checkout Session. I'm not sure why you got an error since Checkout Sessions do support metadata.
Use the Products and Prices you pass in
line_items
to infer data about the goods sold. For instance if you sell T-shirts in 3 different sizes, you'd have a Product for each size (small, medium, large) and a Price for each size describing how much you charge for each. This way when you expand theline_items
property you'd be able to infer data like description, size and amount via the Product and Price objects.If you're still having trouble I recommend jumping into our official Discord where Stripe engineers hang out and help you with your questions!