#jkemper_api
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/1434991964905930783
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hello
I don't believe we have an endpoint that return a list of meter events.
You can only have summaries - https://docs.stripe.com/api/billing/meter-event-summary
You may be able to do what you want with this private preview feature - https://docs.stripe.com/billing/subscriptions/usage-based/analytics
However, my team on discord won't know a ton about it. We only familiarize with publicly available features
Thanks @torpid pivot for the links! Although the preview feature seems to only aggregate over a time period though. My problem is that I don't know exactly the time period that is used for the invoice in the end. It seems as if there is no solution though?!
The invoice usually has period_start and period_end timestamps - https://docs.stripe.com/api/invoices/object#invoice_object-period_start
That for sure, but it is an asynchronous system right? So maybe it is save to say that whatever comes e.g. five minutes before the "period_end" would be within that one period. But we cannot say for sure right?
E.g. if I upload a usage event 1 sec before the invoice is created, then it will probably not be part of that invoice
It depends on the grace period you've set as far as I recall - https://docs.stripe.com/billing/subscriptions/usage-based/configure-grace-period
I didn't try that - do you know that already: If I add a meter event while an invoice is in draft - will that automatically be added to that invoice? Or do I have to configure something "special"?
I see here that if the timestamp fits to the period of the invoice, and the invoice is still in draft, that it would be added: https://docs.stripe.com/billing/subscriptions/usage-based/configure-grace-period#add-usage-to-draft-invoices
Yup, I think the default grace period is upto an hour, so any usage reported during that time should be included.
You can try it out in test mode/sandbox
Okay, so it seems to me that I can control this via the timestamps then. If I use a timestamp of an invoice period that is just ending, then it should always be part of the invoice that will be generated, because I can set the grace period to something like an hour.
And if I have a timestamp that is outside of that invoice's period, I know for sure that it will not be part of that invoice, but of another one.
Would you agree to that?
Correct
Okay! So with that I do think I can conclude what would usage event be part of which invoice - even if there is no specific endpoint showing it. Thanks!