Delete request for 'price' object
Problem
There's currently no delete request for 'price' object with the api. https://stripe.com/docs/api/prices how do you delete prices? setting to active does not work. I am trying to delete 'product' object for connect users, but cannot because price is associated with product.
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Implement Price Deletion via API Workaround
Stripe's API does not currently support direct deletion of price objects. Prices are immutable once created and can only be set to inactive. This limitation prevents the deletion of associated product objects, leading to issues when trying to manage products for connected users.
Awaiting Verification
Be the first to verify this fix
- 1
Set Price to Inactive
First, you need to set the price object to inactive. This will effectively remove it from being used in any transactions or product associations.
bashcurl -X POST https://api.stripe.com/v1/prices/{PRICE_ID} \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d 'active=false' - 2
Detach Price from Product
Once the price is inactive, you can detach it from the product. This step is crucial to ensure that the product can be deleted without any associated prices.
bashcurl -X DELETE https://api.stripe.com/v1/products/{PRODUCT_ID}/prices/{PRICE_ID} \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: - 3
Delete Product
After detaching the price, you can now delete the product object. This will remove the product from your Stripe account.
bashcurl -X DELETE https://api.stripe.com/v1/products/{PRODUCT_ID} \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: - 4
Verify Deletion
Confirm that the product and its associated price are no longer listed in your Stripe dashboard or via the API.
bashcurl -X GET https://api.stripe.com/v1/products/{PRODUCT_ID} \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc:
Validation
Check the Stripe dashboard or use the API to ensure that the product and price are no longer present. You should receive a 404 error when trying to access the deleted product.
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep