#ahsan575

1 messages · Page 1 of 1 (latest)

tacit vesselBOT
old moss
#

Hi there!

stark laurel
#

HI

old moss
#

If you are using line_items.price_data, then you can't store metadata there.

#

You should either use Price objects (which can have metadata), or store the metadata directly on the Checkout Session itself.

stark laurel
#

can i use Price objects for dynamically adding products?

old moss
#

First you create a Product, and then for each Product you can add Prices to it. So you need both Products and Prices.

stark laurel
#

i have like more than 1000 products available to sell on my website, so are you saying I need to store info regarding each one of them in product object and then use it?

old moss
#

There's no limit to the number of products you can store in Stripe. So yes that's an option.
The other option, like I mentionned at the beginning, is to store the metadata directly in the Checkout Session object.

stark laurel
#

is it okay if I use the Checkout Session object to achieve this metadata functionality, i mean from performance, security or efficiency perspective?

old moss
#

Yes absolutely. You can store whatever you want in the metadata, and it will be only visible to you and not users.
Note that there are some limitations, that you can check here: https://stripe.com/docs/api/metadata

stark laurel
#

alright cool. Thanks @old moss for your help. cheers