Skip to Content

Solved: Stripe Payment Development Error “this product cannot be deleted because it has one or more user-created prices” when Delete Product or Price Object using API Call

Problem Symptom

When Stripe Payment developer try to delete a product or price object using API call, an error stating “Error: This product cannot be deleted because it has one or more user-created prices.” display. I have checked in Stripe API Reference documentation but can’t related API information to delete the Product or Price object.

The detailed error message is as below: Error: this product cannot be deleted because it has one or more user-created prices

May I know how to resolve this error? Do I need to delete Price before delete Product object?

Follow the below solution steps to resolve “Error: This product cannot be deleted because it has one or more user-created prices.” error.

Content Summary

Potential Causes
Solution 1: Set Product.active to false
Solution 2: Delete mirrored plan via API
Reference

Potential Causes

Why you can’t delete the Product or Price object?

You try delete a Price object, which has been added to a product, you get an error deleting the Product object. Due to deletion Product object will makes harder for business to do analytics later when look into historical data. In fact, you can’t really delete Price or Product object because the Price API and Product API does not support deletion method.

Solution 1: Set Product.active to false

Recommended not to delete product and price object, archive them by marking it as inactive by setting active to false on the Price or Product if you don’t want to use it again, this is easier for you to reconciliation/reporting in future when the referenced products/prices still exist.

Refer to below steps for how to archive a product from Stripe API Call.

Set "product.active" to false

product.active=false

"active": false,

Set Product.active to false to resolve error "this product cannot be deleted because it has one or more user-created prices" when Delete Price Object using API Call

Solution 2: Delete mirrored plan via API Call

The only case where a Price object can be deleted is when it’s mirroring a Plan and this plan is deleted via the API, which we only support for legacy integrations but actively discourage using.

Reference

Tags

Tags

    Ads Blocker Image Powered by Code Help Pro

    Ads Blocker Detected!!!

    This site depends on revenue from ad impressions to survive. If you find this site valuable, please consider disabling your ad blocker.