#cyau-metadata-qs
1 messages ยท Page 1 of 1 (latest)
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.
- cyau.was.here, 1 day ago, 23 messages
Hello! Not sure I understand. Where specifically are you trying to add metadata?
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
๐ 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?
cyau-metadata-qs
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
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..
okay so that metadata is being set on a product object (prod_xxxx)
https://stripe.com/docs/api/products/object
yes but this is the issue
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?)
Yes, you can create the products and prices on the dashboard & then just pass the ID of the price using price parameter
just to confirm, this will remove all existing items on a subscription and only the provided one below will be set?
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
also no, that just adds on top of it
it doesnt override old items
๐ 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?
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
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... ?
yeah, i set addonIdentifier in product and then check that on webhook updates, look:
and i just update db record
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.
yeah realized that
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?
yes
So the add ons here are each for a different Price amount?
that's easier to do inline like i did so far, but because of this ^^ i will now migrate to making products
pretty much yes, imagine there's just addon xyz and you can change it to any number and you will be billed x * 40 cents
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
wait and that still sets as 1 item?
Yes
Nope
๐
Sure
thats all
๐