#NESH

1 messages · Page 1 of 1 (latest)

ancient snowBOT
distant basin
#

Not sure if the API explicitly exposes that field, you may have to try the delete and then archive if the delete gives an error

#

I will check in to this and get back to you

modest hinge
#

i actually need this exact info before trying to delete, as I'm showin list of products on my system, and have to show the user whether they can delete the prod or not, same as Stripe is doing on their products page on the screenshot above

distant basin
#

Not seeing a way to check this in the API at the moment. Looking further and will let you know what I can find

modest hinge
#

i see there is no direct property saying it, but I don't see even some combination of properties which could give me some info so I could have a conclusion whether it can be deleted or not

ancient snowBOT
modest hinge
#

btw I am using .net sdk, but I guess raw json response could also be considered to get some useful info

distant basin
#

Unfortunatley not as far as I know. You could listen for events for related prices and then set some used attribute on either the metadata or your own DB, but it looks like at the moment we don't surface this info in the API directly.

modest hinge
#

which event can I listen when someone subscribed to a price for the first time, to set metadata for that price. I would later fetch all prices from all products and check that metadata.

Just wondering, if someone deletes the price from the product, that was previously used, but not anymore, could product be deleted as well then. If so, I would need an event for that, to clear metadata from price

wide dome
#

Hi there

which event can I listen when someone subscribed to a price for the first time
You can just do invoice.paid if this is a subscription.

Just wondering, if someone deletes the price from the product, that was previously used, but not anymore, could product be deleted as well then.
If you want to you can do this.

If so, I would need an event for that, to clear metadata from price
An event for which part exactly?

modest hinge
#

it's about subscriptions yes, but will I get price object from the event, should I have it from Invocie.Paid ? so I could store metdata against the price itself - called "everUsed"= true

wide dome
#

You'll get the price id in the invoice object from the invoice.paid event

modest hinge
#

one more thing, I would not say it's enough to say if invocie is paid, to count that price/-> product as used and not "deleteable". Even if I just select price from the product as a new product price for a subscription, before any invoices, I'm restricted from deleting a prod

#

if I do this (updat existing subscription with new price), newProd (parent of the price) would not be able to get deleted. how can i catch that event

wide dome
#

how can i catch that event
Which event? The subscription being updated?

modest hinge
#

event which will say that prroduct price is somewhere added

wide dome
modest hinge
#

data object for that event is subscription which does not contain info about price ? and I need to set metadata to the price of interest directly

wide dome
#

You can retrieve the subscription and expand items

#

Then you'll get the price

modest hinge
#

I see there is price inside items,