#dbjpanda

1 messages · Page 1 of 1 (latest)

primal solsticeBOT
bitter lark
#

Hi there!

#

Do they pay upfront, and then get to use all the token within the month?

#

If they pay upfront, then I recommend using a Standard Pricing, and then keeping track of how many tokens they can use on your end.
And if you want a proration based on the number of tokens, then you should use proration_behavior: none, and compute the proration yourself.

solid zinc
#

Yes, they pay upfront.

#

Where should I set the proration_behaviour ?

#

I let user use a customerPortal link session to update their subscription.

bitter lark
#

Oh I didn't notice you were using the Customer Portal. Not sure how that works in this case... let me check.

solid zinc
#

I am also using stripe hosted customer portal.

bitter lark
#

Yes, the link I shared above is for the customer portal

solid zinc
#

So you mean, while creating a portal session, I should pass the proration_behaviour:none parameter ?

#

However I want the user to prorate on the basis of the token.

bitter lark
#

My idea was to:

  • Step 1: set your customer portal configuration to disable proration when upgrading/downgrading subscription
  • Step 2: compute on your end the proration, and charge the customer accordingly
    But trying to think if there's a better option...
solid zinc
#

Actually, I am using the Firebase Stripe extension. So I have very few customisation capabilities.

This extension provides only createCheckoutSession() and createPortalLink() function

primal solsticeBOT
fiery orchid
#

That will allow you to control the proration behaviour of updates

solid zinc
#

@fiery orchid That's sound interesting. But how can I generate the configuration hash? Is there any exposed function for that provided by the extension?

fiery orchid
#

There is not, you'd need to create that separately

solid zinc
#

Well, and what should I pass in the proration_behaviour? Is it the price after I calculate on the basis on left token and the number of token the user wants to upgrade or downgrade?

#

let's say the pricing :
5USD / Month - 2000 Token
19 USD/ Month - 50000 Token

A user purchased 5 USD/Month -2000 Token

After few days, he/she wants to upgrade his/her subscription to 19 USD/ Month - 50000 Token

His/her Token left is 1000 token from the first subscription.

fiery orchid
#

What kind of billing are you using? Or how are you modelling these tokens in Stripe?

solid zinc
#

I am using Standard Billing. User chooses a subscriptions and pays upfront fee.

I add "token" as meta data to Price inside Stripe

fiery orchid
#

Then there's no way to prorate that token usage automatically, you'd need to handle that yourself

solid zinc
#

Well, then what would you suggest to achieve this? Is it even achievable using that extension?

#

Or may be Package Pricing?

fiery orchid
solid zinc
#

At the end of the cycle, you report the usage to Stripe.

And how do I report it using the Firebase-Stripe Extension?

fiery orchid
#

No, there's no support for that in that extension. You'd do it directly in the API

solid zinc
#

@fiery orchid Thank you for your clarification and patience. I have one last question.

#

If I go for usage based billing, while a user upgrades or downgrades, how do you send the usage report and create a portal link at a single http query. Or is it required to send the usage report first in a separate query and then create a portal link call in a second http query?

fiery orchid
#

I guess you'd likely want to make then in the same HTTP call so that if the usage record fails, then it throws and prevent the portal session

#

It's really an implementation details, up to you

solid zinc
#

It seems I also need to build the portal, because Stripe hosted customer portal does not permit usage based billing.

fiery orchid
#

Ah, yeah 😦

solid zinc
#

Is there any api that will cancel an existing subscription(provided a subscription id) and create a new subscription with new price id in one go instead of cancelling and then creating a new checkout session.

chrome prism
#

Hi 👋 jumping in as my teammate needs to step away soon. No, there is not an endpoint that will both cancel an existing Subscription and create a new one. That will require two separate requests, one to cancel the current Subscription, and another to create the new Subscription.