#Gleb-metered-threshold

1 messages ยท Page 1 of 1 (latest)

vague bloom
#

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.

upbeat kite
#

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.

vague bloom
#

Do you have the ID of the price that you're working with?

upbeat kite
#

Yes, give me a few minutes please.

upbeat kite
#

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.

atomic moss
#

Ah sorry missed the update here, catching up

atomic moss
#

@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

upbeat kite
#

Yes, it's an upcoming invoice

#

@atomic moss

bronze crystal
#

hello, I'm around and catching up,. one sec

atomic moss
#

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

upbeat kite
#

@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:

  1. aggregate_usage=max;
  2. threshold=10;
  3. Report usage with increment;
  4. When I report 11, the client gets their invoice;
    ?
bronze crystal
#

one sec, reading

nocturne wolf
#

๐Ÿ‘‹ @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

upbeat kite
#

Got it. Thank you.