#edutomesco
1 messages ยท Page 1 of 1 (latest)
๐ happy to help
https://stripe.com/docs/api/usage_records/create basically the action parameter is by default increment so you should use set instead and you can always pass timestamp otherwise it will default to now
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
If I pass just timestamp and not the action Set
and I pass the exactly timestamp that another record
it will override?
I'm not sure, but I don't think so
or I should pass the action set too? Because I have subscriptions with billing threshold and the documentation says that I can't use the action Set with subscriptions with billing threshold
then how I can manage if I have a billing threshold?
that's interesting, let me dig into this for a sec
thanks
still looking into this, I'm afraid this might not be possible, but I'm trying to see if there is any workaround
the only workaround I could find is basically keeping track of the actual usage record on your own and just updating with the delta whenever it is positive
e.g. you updated the usage record for 10 but actually it should only be 5, next time if you need to update the usage record for 10 you would add a 10 - 5 update
I know this must be frustrating, but let me try to explain the reasoning behind this. Let's consider that you have a subscription with a billing_threshold set to 10
in that case if you added a usage record of 15 this means that we will generate a new invoice for the first 10
but instead you find out that the usage record should have been 5, if we let you override the value what should we do about that invoice that was generated and paid? this is confusing especially for the customer
let me know if you need any more help
I guess what you can do is create a Customer Credit Balance with the difference if you want your customer to be entitled a "refund" in a sense if you don't want to use "deltas" and keep incrementing instead
this is too much tricky
All these is for a control of GB stored on a hosting, so I need to be consistent
what you mean with deltas?
I mean if you added 50 more than you should have the next time you would add the delta meaning the new usage record - 50
so If I have a record usage of 50
and then I want to register a 50 I should add 0
or If I have 50
exactly
and I want to add 30, I would add -20
that's not possible
so then?
instead what you should do is keep the "remaining delta" as 20 in your system and the next time it would be 50 - 20 = 30 and then you just add the 30
So I just add the usage when?
the next time you need to increment
I mean if I add the 30 then the next time I want to modify I would have the same problem
and if the next time is always to decrement
Imagine I finally need to arrive to 0
Once I registered the 30 I can't modify that
that's why I suggested Customer Credit Balance
how it will work?
because let's say the Invoice now has 30 qty and you need 0 then by adding Customer Credit Balance it would apply a negative amount to the next invoice and it would look something like (let's say the price is 1$/qty)
Credit Balance -30$
Price (1$ Qty 30) 30$
Total 0$
there is no other option I think no?
XD
Because it's extremely hardcoded
You have any example of solution of anybody who controls the storage usage of a hosting or something like this
you can technically create a refund but it would be a lot harder
what do you mean by hardcoded?
that it's too much logic
I'm using the billing theshold just on annual plans in order to trigger an invoice when a the overage is overpassed to not have to set annually values for the overage
you know if maybe there is a bettter way to manage that
Having overage on prices in a annually subscription, but I want to manage monthly the overage consumption
there is no easy way to do that other than creating two separate subscriptions, or creating the overage invoices manually I guess
Okey thanks
sorry
Hey, taking over here. Let me know if there's any follow-up Qs I can answer!
I was thinking I can registered all values on stripe and then just take the most recent usage
Yes you can use this API for that:
https://stripe.com/docs/api/usage_records/subscription_item_summary_list