#p3rm1-d3n13d_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/1343626892615487508
π Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- p3rm1-d3n13d_api, 2 hours ago, 4 messages
- p3rm1-d3n13d_api, 3 days ago, 10 messages
This is related to: #1343626892615487508 message
This is the one that worked before
This is another that do not work
Hi π
Screenshots aren't very useful for us here. Do you have specific Invoice IDs for situations where this did or did not work?
We don't focus on the Stripe Dashboard here so we cannot address any discrepancies there
Hello!
I have a subscription id: sub_1Qw1TyEsiuDlXcqvq5ZgJs2N or you need directly an invoice id?
The thing i need is currently have the qty in the upcoming invoice to be up to date as i need that value before re-triggering a meter event.
I already tried to trigger a meter event manually on stripe dashboard but the result is the same(not up to date).
It was up to date when i tried it about 3 or 2 hrs ago but before that an after(till now) it do not update qty when i trigger meter event.
currently, i'm using the python sdk.
The behavior I need is:
1- I trigger a Meter Event (work)
2- The meter event correctly appears in the list of event on dashboard with the value(work).
...
...
3- I retrieve the upcoming invoice and the quantity in it should become(reflect) the value i sent from the meter event(precisely it should reflect the aggregated value) ---> Doesn't work as i expect it or do i misunderstood how it work?
For step 3, do you use the Upcoming Invoice API or the Create Preview API?
It was not a yes/no question
Ah my bad π . I use the upcoming invoice api (#1343626892615487508 message)
Okay, the tough part with that API is that it's a GET request and we don't store those payloads so I cannot see what we returned.
Can you try out the Create Preview API and see if you get the same incorrect response?
Can you share the request ID or Invoice ID?
The second one.
the 0.5
il_tmp_1fd3ceEsiuDlXcqv1ff944cc
I create a subscription with those two prices. The 2nd is meterd and the 1st is not.
And you have been generating test usage amounts between 2/24 and 3/24?
What do you mean by 1/24 and 2/24?
That's not what I typed
2/24 and 3/24 π
I mean the billing interval for the metered price is for the time period between 2025-02-24 13:13:31
2025-03-24 13:13:00
so only usage that falls between those periods will be counted
Yes, I tested it by triggering metered event during those date-time.
Do you have those API request IDs?
yes: this is one of them: req_cjZGdQpYnjWYsn
Hmmm okay that was created 2 hours after the start of the billing period this invoice is for so it should show up
When I look into the upcoming invoice, it's not included into the metered price.
And the meter you created, mtr_test_61S4k3CghpZ8YMn7s41EsiuDlXcqvE9I, has the event name "user_usage", which is what you passed in.
Yes, it is correct.
I realize I'm not offerring any explanations as yet, I'm just ticking through the possible reasons this might not work but it looks like you are doing everything right to me.
OH π€¦ββοΈ
Usage for an Invoice will not be show until the draft invoice is finalized. I disagree with how this is implemented but it sounds like that is what is happening here.
Hmmm... okay that's only for status: "draft" invoices.
I see that it can take up to 5 minutes to attribute usage to an upcoming invoice due to async processing but the request to add usage happened more than 1 hour before you created the preview
Would you mind if we converted this thread into a Support case so we can keep digging on the source of this discrepancy?
it's OK.
But temporary, is there a way i can get the aggregared value from a meter event?
Bc i need the previous quantity each time before sending a meter event for a specific usage on our app
Hello @quartz kestrel, we have sent you a direct message, please check it at https://discord.com/channels/@me/1343642902680699034
- πThe message has instructions on how to open a direct support case with our Developer Support team, in order to help you more effectively.
By aggregated value, do you mean the total metered usage for the previous billing period?
Does the Meter Events Summary API address this? https://docs.stripe.com/api/billing/meter-event-summary/list
Yes.i'll try to use that api. But at the end of the period the invoice will correctly contain the qty and will be billed correctly right?
I'm not sure I follow. Your default aggregation for this meter is set to "sum" so it should be adding up the usage you report internally. Have you tested this and found that not to be the case?
Yes it is set to sum and and the calculation os correct.(Sometimes i send negative value bc we need a little work around to set the qty).
But i'm just asking that to make sure that the qty value be correct at the end of the period (not like the preview of upcoming invoice)
I would expect it to be correct. but I would also expect the usage to show up in the Upcoming Invoice response. That's why I think we should dig deeper into the source of this discrepancy
Btw, is there a way i can directly set the value of qty instead of using aggregated value.
I look into usage record(the old version of meter) and it contain an option like 'action:set'.
Bc the value i pass will be added to each other value instead of directly replacing value.
So behavior i except thar case is when i pass 2, the value will be directly replacet (set to) 2.
Hello! I'm taking over and catching up...
Kinda. You should be able to set the event ingestion attribute to pre-aggregated, which allows you to set instead of increment within a window of time. See here for more info: https://docs.stripe.com/billing/subscriptions/usage-based/recording-usage#configure-meter
The associated API is here: https://docs.stripe.com/api/billing/meter/object#billing_meter_object-event_time_window