#brian_code
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/1387855142954471535
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
by total do you mean the usage total or the total amount billed?
both if possible ๐
For the usage total for a given period you can utilize https://docs.stripe.com/api/billing/meter-event-summary/object
thanks! So couple follow up questions, if getting the monthly summary, would that be best advised to set start_time to subscription.current_period_start and end_time to current_period_end?
I noticed you can only group by either hour or day, in that case would you have to iterate through each day's summary and add the aggregated_value to get the full month's summary?
"thanks! So couple follow up questions, if getting the monthly summary, would that be best advised to set start_time to subscription.current_period_start and end_time to current_period_end?"
Yes this is probably the easiest way to get the summary for the subscription window.
I believe you can use https://docs.stripe.com/api/invoices/create_preview to get a preview of the what the billed amount based on the usage from the start of the cycle to today
thanks ๐ out of sheer curiosity, is there any particular reason you guys don't offer a week or month filter with summaries?
"If not specified, a single event summary would be returned for the specified time range." So I believe you can just get a single summary for the whole of the subscription billing cycle.
So setting week or month would be for a situation where say you set a several month window and wanted one summary per month in that window. I'm not sure we've seen demand for that but I can always put in a feature request.
makes sense! would be cool to see it as a request just for the sake of simplicity. Appreciate the help. Will ping if anything else comes up ๐
Of course! I'll put a feature request in for you ๐