#markr_usage-records
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/1273711049614299206
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi ๐
Sorry this isn't making much sense to me. Can you explain the usage records you are creating, the aggregation method you are using, and what the behavior is that you do not expect?
We are a file storage platform, and we bill based on storage used.
We create usage records each time a user creates or deletes a file to make sure that the usage is up to date.
We are using max aggregation.
I would expect each record to be separate, and never combined, instead they appear to be summing when they are sent too close to each other. (see example above of when we reported records, and what is shown in Stripe)
This is how we create the usage records.
Hi ๐ can you share the IDs of the requests you made to create the usage records that appear to be getting summed?
I have no idea how I would get those, we did not log them at the time that this occurred.
You should be able to find them through your Stripe dashboard:
https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support site provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
That's happening because you provided the same timestamp in the requests:
When there is more than one usage record with the same timestamp, Stripe adds the quantity values together. In most cases, this is the desired resolution, however, you can change this behavior with the action parameter.
https://docs.stripe.com/api/usage_records/create
You'll want to try passing action set to set to reset the quantity for that 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.
Ah ok. That is a weird default behaviour, but makes sense.
I assume if I don't provide the timestamp it also would not have happened?
I will add the action parameter to my requests though. Thank you!
If you don't specify a timestamp, we use the timestamp of when the request was received.
OK, so that would be even harder to debug.
Would be nice to have that same callout in the timestamp description. I know I just completely skipped over the description of the endpoint, and just looked at the parameters when setting this up
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
markr_usage-records
Oh, I see what you're saying (I thought you were referring to the now behavior, not the summing behavior). The summing is talked about in the action description, since the action controls that behavior.
Yeah, it's a bit weird since the action controls the behaviour, but the timestamp is what is being acted upon.