#dhruvTech
1 messages · Page 1 of 1 (latest)
Hey I have per unit monthly subscription where I need to charge for number of unit used.
Hi, what is your specific issue?
I need to charge for customer how much the customer uses the subscription. I am trying to achieve it using metered based biling
However I need to report the usage as well
Yep that's correct
In week 1 the total reported usage is 20 Seats
In week 2 the reported usage decreased to 10 seats. How can I update the seats count.
If tried sending 20 and then 10 however it adds up 20 + 10 = 30 and charges for 30 seats
However the same seats count decreased to 10
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 you use set it will override, not increase
However to set it I need the timestamp.Could you please help how can I get it?
timestamp is optional, isn't it?
I tried it however it will create new record even if I use set parameter
For overriding I guess we need that specific timestamp
Are you there?
Yes
One moment
Sorry, that set action would override the usage at that exact timestamp, as you observed, and it's used as a "fix"
Instead let's try changing the Price https://stripe.com/docs/api/prices/create#create_price-recurring-aggregate_usage
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
last_during_period instead of sum
No other way to achieve this scenario?
Why another way? Doesn't that work for you?
Let me explain by an example
On 1st march quantity = 2
On 2nd march quantity = 1
On 3rd march quantity = No change
On 4th march quantity = No change
On 5th march quantity = 3
................................
and this overall quantity remain stable till 10th March.
On 11th March overall quantity reduced by 1.
So Now I want the removed quantity(user) should be charged from 1st March to 10 March and remaining will be charged for whole month.
Um that's something our API doesn't support at this time. The Usage API is meant for allowing report anything within the period, but will calculate based on the final number in end of period. It looks like you want a proration on usage
I guess you would need to save the information (the removed one was removed on which day) within your system, then in next Invoice, you calculate the amount you want to charge (ie. 1 unit x 10days/30days) and adjust the Invoice, using an Invoice Item