Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide Delete Price API #1224

Closed
arvindkgs opened this issue Jun 25, 2021 · 3 comments
Closed

Provide Delete Price API #1224

arvindkgs opened this issue Jun 25, 2021 · 3 comments
Assignees

Comments

@arvindkgs
Copy link

I am using stripe's java client version:(20.45.0) to interact with stripe. I want to delete a price, but I don't see delete() or remove() method exposed on com.stripe.model.Price. I don't see delete API on Price API documentation as well - https://stripe.com/docs/api/prices/object?lang=curl ,
however I see from the Stripe dashboard I can delete a Price. I also see that it calls API -
"method": "DELETE","url": "https://dashboard.stripe.com/v1/prices/price_1J68Y8BuQq6cUmE7UYLyucpI"

I know that once a subscription is associated to a price it can't be deleted and price should be archived, instead. However for testing E2E, when I set up a testbed on a test Stripe account I am creating a dummy Price. I should be allowed to delete it.

Would help to expose Delete Price API

@remi-stripe remi-stripe self-assigned this Jun 25, 2021
@remi-stripe
Copy link
Contributor

@arvindkgs That feature is only available in the Dashboard as a way to quickly undo a mistake you made in the UI. We do not plan to support this in the API as we discourage deleting Prices otherwise. This leads to real issues down the road when trying to do reconciliation or analytics once you have a lot of historical data. It's something we used to support on the Plans API and it caused a lot of pain for developers over the years that don't look obvious at first.

What you describe about Price deletion for Test mode makes sense, but it'd be quite tricky to support it only for unit tests and not normal deletion. If it worked in Test mode, you'd expect it to work in production too or your code would break if you made the wrong assumption.

We're instead working on improving Test mode environments to support ephemeral test sandboxes for example which should alleviate the pain you're describing. No firm timeline on shipping support for this yet but it is definitely top of mind for us.

@maxime1992
Copy link

I'm desperately trying to remove a price and after more than an hour spent on this, I'm still completely unable to do so.
Not only this feature isn't part of the SDK, it isn't part of the API at all: https://stripe.com/docs/api/prices?lang=curl

As @arvindkgs pointed out, we can remove a price from the dashboard. So I thought I'd mimic the request manually and I'd be done with it. Turns out, even this doesn't work. Well... There's a trick but it's not applicable for CI.

Basically, if I use the value of my Stripe API key as bearer token, I can query anything else, but for this endpoint specifically the return I get is:

{
  "error": {
    "message": "Unrecognized request URL (DELETE: /v1/prices/price_XXXXXXXXXXX). Please see https://stripe.com/docs or we can help at https://support.stripe.com/.",
    "request_log_url": "https://dashboard.stripe.com/test/logs/req_XXXXXXXXX?t=XXXXXXXXX",
    "type": "invalid_request_error"
  }
}

And if instead I use the token I find in the devtool while looking at any request made on Stripe's web page, then it works.
I understand why you don't want to expose this and therefore it wouldn't be part of the doc. But at least not block the request based on the token so that people can go around it for testing. I'm just going to end up with thousands of prices I'll have to cleanup manually from time to time

@remi-stripe
Copy link
Contributor

@maxime1992 See stripe/stripe-python#658 for many more reports and my explanations as to why we don't support this. For now we have no plans to add this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants