#cyau-metadata-qs

1 messages ยท Page 1 of 1 (latest)

silver thunderBOT
#

Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

lyric ore
#

Hello! Not sure I understand. Where specifically are you trying to add metadata?

silver thunderBOT
tiny birch
#

so if you check top right picture, i use line_items and my metadata is in the price_data.product_data, now im not sure how to update that

#

in code on left im looping over subscriptions, their items, and then each item's price product where that metadata actually is

rain jackal
#

๐Ÿ‘‹ taking over here
Give me a second to catch up

#

So in the first screenshot you're setting metadata on the Product object and in the second screenshot you're setting it on the Subscription object

taking a step back, whats your end goal? What are you trying to do? Where do you expect the metadata to be?

silver thunderBOT
#

cyau-metadata-qs

tiny birch
#

i think you messed up screenshots, so i think only first one would matter (in initial message), so code on the right from the green line is how i make a subscription, and code on the left side of green line is just how im trying to update that 'addonIdentifier' which is in metadata from the right

rain jackal
#

Sorry you shared two images with code but no clear context on what you're trying to do with it.
I understand you want to update the metadata on an object but it is unclear which ones..

tiny birch
#

im trying to update this

rain jackal
tiny birch
#

since it was made with sessions

#

i have one idea for that, so if i actually make a real product on stripe dashboard, is there a way i can fully override products on a subscription? (so those "automatically made" get removed?)

rain jackal
#

Yes, you can create the products and prices on the dashboard & then just pass the ID of the price using price parameter

tiny birch
#

just to confirm, this will remove all existing items on a subscription and only the provided one below will be set?

rain jackal
#

I believe so

#

give it a try

tiny birch
# rain jackal I believe so

i didnt try it yet, but i have a question, if i want to offer user something additional, like some number of bonus integrations, how would i do that dynamically with stripe but so that i can update metadata

#

because if range of how much user could select is 1-100, what will i have 100 different products with different price each

#

because ei. price would be count * 40 cents

tiny birch
#

it doesnt override old items

rain jackal
#

sorry for the delay here

#

things are running a bit busy

tiny birch
#

all's fine

#

its no rush

tight scaffold
#

๐Ÿ‘‹ stepping in to help

#

Okay so let's step back a moment.

#

Why do you want to update metadata on the Product to begin with?

tiny birch
#

because how i currently make subscriptions, i dont have single global product so i could just modify it, i have it per subscription due to sessions api

tight scaffold
#

But what purpose does that metadata serve? Like I want to make sure this is the best route for you to go and there isn't an easier way.

#

It tracks the actual Product?

#

Like you look at that metadata for the Product in your database?

#

Or... ?

tiny birch
#

yeah, i set addonIdentifier in product and then check that on webhook updates, look:

#

and i just update db record

tight scaffold
#

Okay yeah I don't understand, sorry. I can't just look at screenshots of code and infer what you are doing.

Overall, you can't update metadata on a Product that you created inline. If you do want to update the Product's metadata then you would create the Product ahead of the Checkout Session and then pass that Product ID to line_items.price_data.product instead of using line_items.price_data.product_data.

tiny birch
#

yeah realized that

tight scaffold
#

Okay

#

So then we are onto your second question? Which is

if i want to offer user something additional, like some number of bonus integrations, how would i do that dynamically with stripe but so that i can update metadata
because if range of how much user could select is 1-100, what will i have 100 different products with different price each
because ei. price would be count * 40 cents
correct?

tiny birch
#

yes

tight scaffold
#

So the add ons here are each for a different Price amount?

tiny birch
tiny birch
tight scaffold
#

Why wouldnt you just use quantity for the x there?

#

You only need 1 Product and 1 Price if it is just $0.40 per quantity

tiny birch
#

wait and that still sets as 1 item?

tight scaffold
#

Yes

tiny birch
#

so its not x different entries

#

oh

tight scaffold
#

Nope

tiny birch
#

well

#

good to know now

tight scaffold
#

๐Ÿ˜‚

tiny birch
#

thanks

#

lol

tight scaffold
#

Sure

tiny birch
#

thats all

tight scaffold
#

๐Ÿ‘