#phanboi158_best-practices
1 messages · Page 1 of 1 (latest)
👋 Welcome to your new thread!
⏲️ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).
⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can 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/1254684737599967334
📝 Have more to share? Add details, code, screenshots, videos, etc. below.
I asked this question on Insiders as well: https://insiders.stripe.dev/t/usage-based-billing-daily-aggregate-question/1252
Sorry if this question doesn’t belong here. But it’s a question about usage-based billing in general. When reporting daily-aggregate usage for a subscription, what time do I consider is the start of a new day? A) The time part of the subscription’s billing cycle anchor (i.e. the time of day when the subscription was created) B) 00:00:00 UTC
It really depends on the timestamp that you set on the meter event. https://docs.stripe.com/api/billing/meter-event/create#create_billing_meter_event-timestamp
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Did you set it before the billing renewal (i.e., June 5 03:00:00 UTC.) ?
I'm reporting daily pre-aggregated usage every hour throughout the day. For July 5, there will be 24 meter events sent, one per hour. All of these events will have the timestamp set to July 5 00:00:00 UTC to indicate that it is pre-aggregated usage for July 5.
These 24 meter events will have increasing values, as you would expect the usage to increase throughout the day for this customer. However, as I explained in the original question: At 3am on July 5 an invoice will be generated for this customer. At that time, we have sent only 3 meter events so far for the day, which reports usage data from midnight up to 3 am! That means the generated invoice includes usage data for only first 3 hours of July 5.
Yes you are right, the invoice will only include the usage that your application has reported.
At 3am when the invoice is generated, let us say the value reported so far is X.
At the end of the day on July 5, let's say the final reported usage is Y where (Y > X).
This invoice will bill amount X.
The next invoice will bill amount Y-X.
Stripe will intelligently do the subtraction, can I assume?
Yes, you can test it out with test clocks