#vini_api

1 messages ¡ Page 1 of 1 (latest)

mellow rootBOT
#

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

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

deep phoenix
#

Basically I wanted to get the information that shows in the "upcoming invoice"
But I'd need to know:

  • current total usage based on the meter events for the current billing period for the different products under this subscription
fervent coyote
#

Hi there - I'll be with you shortly

deep phoenix
#

Sure, thanks @fervent coyote

fervent coyote
#

Alright, sorry for the wait; the server has been busy this morning

#

So that is to say you want to know how to retrieve all usage on a specific Subscription at a particular moment in time?

deep phoenix
#

For the current billing period would be enough! So what I'm not sure is if there's a better way than having to do the steps I described above, and I couldn't find in the API docs any other better way, so wanted to confirm

#

In my example above I have a price with the first 1000 units being free and then I start charging 1cent/unit
So I'd like to know if the usage is still below the 1000 units and what the exceeding (thus billable) is

fervent coyote
deep phoenix
#

Yeah, that's the only endpoint I found about doing it
But then there's no way around having to get the subscription to know the current billing period for that subscription, right?

And then I'd do the sum of all the event.aggregated_values - 1000 (which is the limit I know I've set) to know the exceeding, right?

fervent coyote
#

Yeah, I think the code you write to do this would have to be "aware" of what the billing period is on the individual Subscription in order for this to be useful in the way that you would like it to be

deep phoenix
#

Okay, sounds good, thanks @fervent coyote!

fervent coyote
#

You're welcome!