#p3rm1-d3n13d_api

1 messages Β· Page 1 of 1 (latest)

ember sealBOT
#

πŸ‘‹ 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.

quartz kestrel
#

This is the one that worked before

#

This is another that do not work

silver adder
#

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

quartz kestrel
#

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.

silver adder
#

What is the behavior you are trying to validate?

#

Are you using the API?

quartz kestrel
#

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?

silver adder
quartz kestrel
#

yes

#

And to see if the qty is up to date i look into lines data

silver adder
#

It was not a yes/no question

quartz kestrel
silver adder
#

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?

quartz kestrel
#

Ok, i'll try that one

#

It's the same.

silver adder
#

Can you share the request ID or Invoice ID?

quartz kestrel
#

upcoming_in_1Qw5LeEsiuDlXcqvEPL7jsHL

#

this is the upcoming invoice id

silver adder
#

Cool thanks, taking a look

#

Which Price is the metered one?

quartz kestrel
#

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.

silver adder
#

And you have been generating test usage amounts between 2/24 and 3/24?

quartz kestrel
#

What do you mean by 1/24 and 2/24?

silver adder
#

That's not what I typed

quartz kestrel
#

2/24 and 3/24 πŸ˜…

silver adder
#

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

quartz kestrel
#

Yes, I tested it by triggering metered event during those date-time.

silver adder
#

Do you have those API request IDs?

quartz kestrel
#

yes: this is one of them: req_cjZGdQpYnjWYsn

silver adder
#

Hmmm okay that was created 2 hours after the start of the billing period this invoice is for so it should show up

quartz kestrel
#

When I look into the upcoming invoice, it's not included into the metered price.

silver adder
#

And the meter you created, mtr_test_61S4k3CghpZ8YMn7s41EsiuDlXcqvE9I, has the event name "user_usage", which is what you passed in.

quartz kestrel
#

Yes, it is correct.

silver adder
#

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?

quartz kestrel
#

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

ember sealBOT
#

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.
silver adder
#

By aggregated value, do you mean the total metered usage for the previous billing period?

quartz kestrel
silver adder
#

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?

quartz kestrel
#

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)

silver adder
#

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

ember sealBOT
quartz kestrel
#

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.

noble grail
#

Hello! I'm taking over and catching up...