#j-warin_best-practices
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1316508891059851366
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
For storage are you charging per MB or GB?
How does that work
And do they pay for a storage limit (ie they have a 1TB limit for example) or pay for how much they're actively using?
Not sure yet! Could charge by GB.
For example, first 5GB free, then 1$ per GB per month.
But if one month you don't add or remove any files, and you use 6GB in total, you still pay 1$ this month.
Yeah sounds like you want a fixed fee for that
So you'd have a subscription with 2 prices
1 metered for the compute
and 1 fixed for the storage
But I can't use a meter to record storage usage, right ? I would send stripe storage increment of decrement per user.
You can
Depends on how you want to model the pricing
But what you described to me is a fixed price
I might not express it correctly, sorry ...
Alright, let say you subscribe and it's 10$ a month and you get 5GB included.
Extra storage is 1$ per GB.
You upload a 6GB File, so first month you pay 1$ extra at the end of billing period.
Then second month even if you do nothing, price is still 11$
When I uploaded the file, I used a meter event to say "add storageusage to this customer"
When I delete a file, I use a meter event to say "remove storage usage from this customer"
Would that work ?
I personally wouldn't use a meter for that
I would have 2 prices
1 for $10 a month base
Then a second which is a $1 price
And you can update the quantity of that second $1 price on the sub depending on how much overage they use
Or you could do a $10 fixed price and a second metered price for the overage
Up to you
Seems like easiest would be to limit storage to 5GB then they can upgrade by subscribing to an extra storage option. In that case I keep track of total storage and check subscription ?
What do you mean
By this part: In that case I keep track of total storage and check subscription ?
So my confusion comes from the following : "Who keeps track of the total storage usage ?"
So I keep a field with each customer's storage user and bill accordingly then ?
I mean you need to be keeping track of this in your database
But I'd assume the customer can upgrade storage in your app
At which point you'd also need to update the subscription in stripe
Not sure i really understand what you're asking
Well I guess this whole thing comes from me thinking you might have a Meter for which you can increment and decrement value, that does not reset every month. Then I don't need to keep track myself.
That's not a meter
That's a fixed price with a quantity which you can increment and decrement
What I described above
Sounds good, thanks for the help !
No problem
via this api request: https://docs.stripe.com/api/subscriptions/update#update_subscription-items-quantity
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
You'd call that endpoint to update quantity of the $1 price depending on overage use
Ok now I think I understand how to do it. thanks so much
I suppose, add_invoice_items.price --> Extra Storage x what is needed ?
What do you mean
via this api request: https://docs.stripe.com/api/subscriptions/update#update_subscription-items-quantity --> I update the quantity by updating one of the prices of the subscription ?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
You update the quantity of the subscription item containing the $1/month price
Sounds good !, sorry my mistake I meant items.quantity not add_invoice_items.price
Last question, let's say this update happens in month 1, then we do nothing, the quantity will be kept for the second month ?
Yeah unless you update it again to decrement
Perfect, that's exactly what I needed thank you so much, especialy the prompt response !
Good day !