DEV Community

Discussion on: Purchase fulfilment with Checkout, or “Wait, what was I paid for?”

Collapse
 
mnc12004 profile image
Michael Cockinos

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.

Collapse
 
paulasjes profile image
Paul Asjes

You have two options here:

  1. Use metadata on the Checkout Session. I'm not sure why you got an error since Checkout Sessions do support metadata.

  2. 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!