#NESH
1 messages · Page 1 of 1 (latest)
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
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
Not seeing a way to check this in the API at the moment. Looking further and will let you know what I can find
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
btw I am using .net sdk, but I guess raw json response could also be considered to get some useful info
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.
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
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?
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
You'll get the price id in the invoice object from the invoice.paid event
Then you can call this endpoint to update its metadata: https://stripe.com/docs/api/prices/update#update_price-metadata
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
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
how can i catch that event
Which event? The subscription being updated?
event which will say that prroduct price is somewhere added
You can use this: https://stripe.com/docs/api/events/types#event_types-customer.subscription.updated
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
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