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

Delete request for 'price' object #916

Closed
johnnyperdomo opened this issue Jun 7, 2020 · 11 comments · Fixed by #933
Closed

Delete request for 'price' object #916

johnnyperdomo opened this issue Jun 7, 2020 · 11 comments · Fixed by #933
Assignees

Comments

@johnnyperdomo
Copy link

johnnyperdomo commented Jun 7, 2020

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.

@johnnyperdomo johnnyperdomo changed the title Delete request for price id Delete request for 'price' object Jun 7, 2020
@remi-stripe remi-stripe self-assigned this Jun 7, 2020
@remi-stripe
Copy link
Contributor

remi-stripe commented Jun 7, 2020

@johnnyperdomo We do not support Price deletion or deleting Products associated to a Price. We instead encourage marking all of those as inactive instead. This ensures that you keep your data present whenever you need to do analysis or reconciliation in the future.

I'm going to close this ask because it's not really a bug or a feature request about stripe-node and it's more a question about our API. I'd recommend talking to our support team instead: https://support.stripe.com/contact

@johnnyperdomo
Copy link
Author

Ok. Makes sense. It seems strange that prices are still able to be deleted in the dashboard.

@sheedy
Copy link

sheedy commented Jun 17, 2020

@remi-stripe I spoke with support yesterday after trying to figure out if I'd misunderstood the docs and they weren't able to answer why updating a price's unit_amount wasn't possible. As I explained to them:

I just noticed the API allows updating a price but doesn't allow updating... the price (unit_amount)... what am I missing?
...
Seems really odd to be able to create a price with amount (required) but not be able to update it, don't you think? I mean the core attribute of a price is it's amount

As a workaround I thought I'd delete the price and create a new one (I only want/need one for my scenario) and only found this issue after a lot of digging for a delete endpoint (or update with unit_amount).

I think a total absence of a prices delete endpoint or unit_amount property from the update endpoint or an explanation as to why these don't exist is confusing.

Could that encouragement to "mark all of those as inactive instead" not be shifted to the docs instead of here? Especially given that you can delete a price or change its amount in the dashboard.

FYI, the Plan docs states (emphasis mine):

You can now model subscriptions more flexibly using the Prices API. It replaces the Plans API and is backwards compatible to simplify your migration.

@remi-stripe
Copy link
Contributor

@sheedy We don't support modifying the amount since that prevents reliable reconciliation over time. This has always been true even before we introduced Price as you could not modify the amount associated with a Plan. This is a core tenet of our API for Billing in general and something we would not change.

If you want to change the pricing for your business/offering, you should mark the old Price as inactive and just create a new one and start using the new Price for your new customers. You can also optionally migrate your existing customers to the new Price as needed. Both Price objects should be under the same Product so that reporting is aggregated and coherent.

@sylflo
Copy link

sylflo commented Jun 27, 2020

@sheedy We don't support modifying the amount since that prevents reliable reconciliation over time. This has always been true even before we introduced Price as you could not modify the amount associated with a Plan. This is a core tenet of our API for Billing in general and something we would not change.

It's totally logical but why doing this in the unit test then ?

describe('update', () => {
    it('Sends the correct request', () => {
      stripe.prices.update('priceId3', {
        amount: 1900,
        currency: 'usd',
      });
      expect(stripe.LAST_REQUEST).to.deep.equal({
        method: 'POST',
        url: '/v1/prices/priceId3',
        headers: {},
        data: {amount: 1900, currency: 'usd'},
        settings: {},
      });
    });
  });

If it's not possible to modify the price amount, I don't understand why putting the unit test with those parameters. Or do I miss something ?

@remi-stripe
Copy link
Contributor

@sheedy Sorry for the confusion I'll get it fixed. stripe-node unit-tests don't hit our API and are here just to ensure the paths are defined properly.

@remi-stripe
Copy link
Contributor

I just shipped a small fix in #933 so that we now only update active: false instead to avoid confusion!

@sheedy
Copy link

sheedy commented Jun 29, 2020

We don't support modifying the amount since that prevents reliable reconciliation over time. This has always been true even before we introduced Price as you could not modify the amount associated with a Plan. This is a core tenet of our API for Billing in general and something we would not change.

@remi-stripe Thanks, that makes sense.

I think it would be very helpful to add this reasoning to the Prices section of the docs for others that are looking for these endpoints as it's not mentioned anywhere else other than this issue (as far as I could find).

@jenjen75
Copy link

jenjen75 commented Oct 19, 2020

@sheedy We don't support modifying the amount since that prevents reliable reconciliation over time. This has always been true even before we introduced Price as you could not modify the amount associated with a Plan. This is a core tenet of our API for Billing in general and something we would not change.

If you want to change the pricing for your business/offering, you should mark the old Price as inactive and just create a new one and start using the new Price for your new customers. You can also optionally migrate your existing customers to the new Price as needed. Both Price objects should be under the same Product so that reporting is aggregated and coherent.

@remi-stripe : Why unit_amount and others parameters (like currency, recurring) from Price can be directly updated from https://dashboard.stripe.com and not from the API ?

@jenjen75
Copy link

jenjen75 commented Oct 19, 2020

And also, method DELETE API for Price seems to exist (I deleted Price from Stripe Dashboard)

Capture d’écran de 2020-10-19 16-06-09

Capture d’écran de 2020-10-19 16-15-33

When I tried CURL command for delete

curl https://api.stripe.com/v1/prices/price_1HdIjBAETkNZIn0imyTKgRzH -u sk_test_[KEY]: -X DELETE

{ "error": { "message": "Unrecognized request URL (DELETE: /v1/prices/price_1HdIjBAETkNZIn0imyTKgRzH). Please see https://stripe.com/docs or we can help at https://support.stripe.com/.", "type": "invalid_request_error" } }

@remi-stripe
Copy link
Contributor

Why unit_amount and others parameters (like currency, recurring) from Price can be directly updated from https://dashboard.stripe.com and not from the API ?

The Dashboard has a special exception letting you change a Price if it has never been used. It also lets you delete prices because of the legacy compatibility with Plans but it's not something we want developers to rely on in their code and it's not available in the public API.

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

Successfully merging a pull request may close this issue.

5 participants