#john-obelenus_best-practices

1 messages ¡ Page 1 of 1 (latest)

errant dawnBOT
#

👋 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/1280975866968670292

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

strong steeple
#

I plan to hit the SUM meter API each hour, with the number of resources...

wraith cobalt
#

Hello

#

That doesn't really work anyway though, right?

#

Like even with the daily idea, they could do 2399 in one hour and it be considered free

#

Because it would be under the 2400 tier

strong steeple
#

Mm, also true

wraith cobalt
#

So really I'd recommend you re-think your model and what you want to achieve here

strong steeple
#

We are clear on what we want to achieve. I am trying to figure out the correct configuration in Stripe to get the behavior

#

Each resource is $0.007/hr... under 100 resources per hour is free. Once you go over 100 in an hour, all resources are charged.

#

We can be pretty flexible on how we deliver the meter data...

wraith cobalt
#

Yeah I mean if you want to charge monthly for a configuration like that then you really have to handle those calculations outside of Stripe and then report the accurate usage to the Meter

#

You can't really establish something like that if you aren't going to actually charge on that time frame

strong steeple
#

How can we determine the up_to number for months with 28, 30, and 31 days when the number has to be static? Depending on the number we pick, folks will get months free, or charged one month a year

wraith cobalt
#

Yeah the general idea is that the number of days in the month shouldn't matter

strong steeple
#

When we are billing by hour, and the number of hours in a month change...

wraith cobalt
#

Since it wouldn't matter if you were actually giving a free amount per month

#

And not per day

#

Or per hour

#

That's what I'm saying

#

Metered Usage is not designed for you to do usage per hour but charge per month

#

That isn't how it works

#

You do usage per month and charge per month

#

So what you could do is just track the free stuff your self in your own database and then just report the non-free usage to Stripe to charge if you want to go that route

#

But you can't accomplish what you want right now solely within Stripe

strong steeple
#

Meter doesn't have a "pre-aggregated monthly" option

wraith cobalt
#

Not sure what you mean by that?

strong steeple
#

Again, I can be very flexible with how we send data to the meter. So, "raw"... I could send a value for the whole month in there... one per customer.

wraith cobalt
#

Okay yeah that you probably want to do what I stated above? You track the free / charged amounts on your side if it is going to be free per-hour and then you just pass the charged amount to the Meter and you don't have a free tier within Stripe. Otherwise, I'd recommend just deciding on a free amount that takes into account the fact that there are a different amount of days in the month and figure out what constant you want to use for that.