#jack-metadata-expand

1 messages · Page 1 of 1 (latest)

olive bearBOT
gusty elbow
#

Hello! I you said you added metadata to the Product so it's normal it wouldn't be on the Plan which is a completely separate resource. Also Plan has been deprecated for years, you should use the Price API instead

#

jack-metadata-expand

ivory steeple
#

my bad
did that on price itself sorry for confsuion
priceID -> price_1NhXreFBOk0mujJ71k69BOvV

gusty elbow
#

That Price has no metadata at all

ivory steeple
#

and doing price, err := price.Get(priceID, priceParams)

gusty elbow
#

so I assume you set it on the Product and not on the Price right?

ivory steeple
#

yes
like this

gusty elbow
#

Okay so what is the problem? You set metadata on object A, then you retrieve a completely separate object B and that object would have no metadata

ivory steeple
#

where do i set on price then

#

like how can set metadata on price object

ivory steeple
#

okay and is there any purpose for the metadata that i just set
can it also be retreived somehow?

gusty elbow
#

You set the metadata on the Product. If you retrieve the Product, which is a separate resource/API then it will be there

#

every object has its own separate metadata and you set metadata on the object you want, that's controlled with your own code

ivory steeple
#

i checked the product struct
there is a field DefaultPrice, is there any way to fetch all prices related to that product?

gusty elbow
#

Also when you call the Retrieve Price API, you can use the Expand feature: https://stripe.com/docs/expand to also expand the Product at the same time and see its metadata (what you mentioned earlier)

#

that documentation page has a clear example code for all languages

ivory steeple
#

yep got it