invertase / stripe-firebase-extensions

Repository of Firebase Extensions built by Stripe.
https://firebase.google.com/products/extensions
Apache License 2.0
426 stars 161 forks source link

[FAQ] Seat-based pricing (setting & updating quantities) #88

Open cloudprism opened 3 years ago

cloudprism commented 3 years ago

Feature request

Is your feature request related to a problem? Please describe.

I want my customers to be able to reconfigure existing subscriptions based on the number of seats required by their projects.

Describe the solution you'd like

I want to define a single subscription model with a set of defined prices per seat count. I do not want users to have to create a new subscription when they add or remove seats. I want the existing subscription to update to reflect the change in seat count.

Describe alternatives you've considered

I have considered flat pricing per project as well as tiers of usage-limited subscription plans. I will likely employ the former, though will also continue to think about alternatives, such as instead providing additional features with a premium subscription, which may even allow support for a free tier of service.

Additional context

I would prefer not to change my business model after I launch, but I suppose I could weather the transition to a seat model if it is eventually supported.

My main worry is that my server costs per subscription are currently unbounded. If usage per project scales dramatically, my business model is likely not viable. However, this is true even with seat-based pricing. I will likely need to introduce limits and tiers regardless of whether seat-based pricing gets support.

Finally, I am making this request both at the direction of the paragraph below and to increase visibility into the experience of using Stripe.

"The extension currently supports pricing plans that bill a predefined amount at a specific interval. More complex plans (e.g. different pricing tiers or seats) are not yet supported. If you’d like to see support for these, please open a feature request issue with details about your business model and pricing plans."

Thank you for reading this request!

thorsten-stripe commented 3 years ago

Hey @cloudprism, seat based pricing is already supported via quantities. You can set a quantity (amount of seats) when creating the initial checkout session:

const docRef = await db
    .collection('customers')
    .doc(currentUser)
    .collection('checkout_sessions')
    .add({
      price: 'price_1234',
      quantity: 5, // set to amount of seats
      allow_promotion_codes: true,
      success_url: window.location.origin,
      cancel_url: window.location.origin,
    });

And you can allow customers to update their subscription quantity in the customer portal by enabling it in your settings: https://dashboard.stripe.com/test/settings/billing/portal

image

The quantity is synced to the subscription doc in Cloud Firestore: image

SDrinkwater commented 3 years ago

Update (1/12/20): After digging a little more into the docs, it looks like I was mistaken. Seat based pricing with quantities should work well for the use case I described, especially given the proration behaviour.

@thorsten-stripe

I think @cloudprism is looking for metered pricing, not seat-based (please correct me if I have misinterpreted the description).

I am in a similar situation where I would like to charge users for the number of "seats" used over a month. The number of seats isn't know ahead of time and can change at any time. I don't want to charge users as soon as they add a seat, just at the end of the month given their most recent usage. This seems to best fit the metered billing model.

For reference, this pricing model is essentially identical to Slack's pricing model.

dblackherod commented 3 years ago

@SDrinkwater I just mentioned this in a fresh issue. It seems quantities do not work with metered pricing. The update note is also clear the v0.19 of this firebase extension is a beta release.

mksquad87 commented 3 years ago

Hi @thorsten-stripe you said that you could allow a user to update his amount in the customer portal. How exactly would i do that? Id have to create another checkout session right? Im a bit confised about which parts are done by the extension‘s CFs and which part has to be done manually by writing own CFs and connect them with the stripe api...🤔 Could u please briefly describe the steps how u would handle an update of the amount an existing subscription?🙏🏻

Br and thanks for the hard work u did to build the extension! It does make life a whole lot easier!

thorsten-stripe commented 3 years ago

@mksquad87 thanks for the kind words! What do you find unclear about the instructions above: https://github.com/stripe/stripe-firebase-extensions/issues/88#issuecomment-720308869 ?

dackers86 commented 2 years ago

Closing due to inactivity, happy to re-open if further documentation is required for this feature.

Lxstr commented 1 year ago

@mksquad87 @thorsten-stripe @dackers86 I believe it is unclear as to how you would actually implement a seats based model. Here is one possible solution using 2 cloud functions that account for adding/removing users or adding/changing subscriptions. Any feedback would be great.

https://github.com/Lxstr/stripe-firebase-seats