#Gleb-metered-threshold
1 messages ยท Page 1 of 1 (latest)
HI again ๐ you're trying to implement two conflicting approaches. You can't bill a user for the highest usage in a period if you're trying to bill them before the period is over.
This is why thresholds don't work in conjunction with charging based on the highest usage record.
Ok, but shouldn't the billing period get closed with the threshold got trespassed and a new billing period started at that exact point? How does it work with "set" ? It has the same billing period as if we were working with "increment"
Also, what I noticed is that no matter what I pass, set, or increment, the total value in the invoice on Stripe dashboard is always the max value. So I just can't see the difference.
Do you have the ID of the price that you're working with?
Yes, give me a few minutes please.
Here's the price Id:
price_1JxCxeDuKRy66s2QJKeezPJY
Sorry for taking so long
Here's the invoice with number of
F636B213-0002. As you can see, the billed quantity is 10 when it should've been 15, since I was incrementing it.
Ah sorry missed the update here, catching up
@upbeat kite is this the upcoming invoice? I wasn't able to find that invoice ID in your account, but -0001 is from sub_1JxCyxDuKRy66s2Qp8jUAfS4 which an upcoming invoice which matches what you're showing
hello, I'm around and catching up,. one sec
I believe this is because you set up the price to use aggregate_usage=max https://dashboard.stripe.com/test/logs/req_0w3SluJ1b8Tibh
and 10 was the largest usage in that period
you might want to be using aggregate_usage=sum instead, if you expect the total to be used
@atomic moss the thing is that I do want it to be aggregate_usage=max. But what I also want is to set up the threshold of 20 items. So that when we reach the quantity of 20 - the client gets invoiced. It should be done with set action I assume. So that when I set the quantity above 20, the client is invoiced. Although, it does not let me do that saying that with the threshold I have to use increment. What I expect to see when I use increment is the value gradually increasing, but it is not. I am totally confused.
The main question - will it work for me if I setup:
aggregate_usage=max;threshold=10;- Report usage with
increment; - When I report
11, the client gets their invoice;
?
one sec, reading
๐ @upbeat kite sorry for the wait, I'm also catching up
What you're asking for won't work - with billing thresholds we only allow you to report usage with increment, which doesn't make sense for prices with aggregate_usage: max. We probably shouldn't be allowing you to report usage with increment for these prices anyways, which I can surface as feedback to the team
Got it. Thank you.