#nick-metered-subscription-qs

1 messages ยท Page 1 of 1 (latest)

civic bear
#

Hello ๐Ÿ‘‹
give me a moment to look into it

west compass
#

Thanks!

#

I also just tried with the CLI, and it did the same thing. However, my usage could be incorrect: stripe usage_records create si_KuttA54npWIBbD --quantity 1818 --action set

civic bear
#

thank you for your patience
still looking into it

west compass
#

No worries!

turbid jackal
#

Do you have the request ID (req_123) from a time you tried to record this usage?

#

I am having trouble finding the calls for recording usage to si_KuttA54npWIBbD on the account that si_KuttA54npWIBbD exists on

#

Oh never mind I see it

west compass
#

I don't, and the "Logs" tab of the Developers section doesn't record them either

#
stripe usage_records create si_KuttA54npWIBbD --quantity 1818 --action set
{
  "id": "mbur_1KJhIJI67GP2qpb4JIoPQaju",
  "object": "usage_record",
  "livemode": false,
  "quantity": 1818,
  "subscription_item": "si_KuttA54npWIBbD",
  "timestamp": 1642610759
}

This payload was returned by the last CLI call, if that's helpful in any way

turbid jackal
#

Yes, it looks like it is not set on this price so it defaults to sum . You will want to create a new price and set aggregate_usage to last_during_period or last_ever

west compass
#

Will that still allow me to sum if I want to?

#

Basically I'm wondering, can I use a mix of both SET and INCREMENT?

We are recording usage daily throughout the month (using INCREMENT), but at the end of the month I'm trying to validate that the usage in Stripe matches what we have on our end, and if it doesn't, I want to override the value with SET

summer lark
#

๐Ÿ‘‹

#

Let me start by clarifying usage records + set/increment. Set/Increment are more relevant when you are override the quantity at a specific timestamp. For example if you created a new usage record at timestamp 1642610759, using increment and set would both behave the same since there is no existing usage record at timestamp 1642610759. If you were to create another usage record at the same timestamp 1642610759 after the first request, you'd use set if you wanted to override the previous value, and you'd use increment if you wanted the new usage record to be added to the previous one.

#

With that in mind, if you want to correct usage records at the end of the month you can:

  • create a new usage record for the current timestamp if you want to ADD more usage
  • modify existing usage records at previous timestamps with action: set to override the usage value at that point to a lower number
west compass
#

Thanks for the clarification. Just to confirm, you can use set for any aggregation type, but you must pass a timestamp you want it to "set", otherwise it will just see it as new usage and increment

summer lark
#

Yup!

west compass
#

Got it. Ok, thanks for your help, @summer lark and @turbid jackal and @civic bear