#xiah-metered-billing
1 messages ยท Page 1 of 1 (latest)
I'm not sure I understand the question. What do you call "subscriptions that haven't started yet"
I create a subscription with a billing_cycle_anchor that is set for a future date, with proration_behavior set to none, as to not immediately generate any invoices.
okay so the subscription is already started and active
and so what's the problem? What is your code doing and what issue are you getting?
Whenever I submit a usage record with the behavior set to increment it just sets the provided value, both within Stripe, as well as my app.
Whoops, didn't refresh the site.
And you set the exact same timestamp each time?
I did not.
then that's expected
I'm not sure I grasp why you use increment if you are simply passing a different timestamp each time
Interesting. I guess I failed to check invoices previously, and was just misremembering. Was wanting to increment whatever the current reading for the period was, without modifying existing values.
Thanks.
Sure thing, let me know if you have more questions!
It appears that it would actually make sense for me to use timestamp, and just use the created timestamp of invoices after the billing cycle anchor to achieve the behavior I want. I'll probably have to use some arbitrary date for the period before invoices are created, but I can figure that out.
What exactly is the meaning of the date? My use-case would basically be using timestamps as an id/hash, rather than a history or log. If I'm incrementing a value for a past date in the future, then that date technically isn't "correct" from my point of view, so I'm not sure if I'm misunderstanding the intent.
I don't really grasp your wording/what you describe
usually timestamp is a record of the usage. Like say you charge per minutes of phone calls in a month
you want to record the timestamp of the phonecall when it started for example
My specific use-case is for electric metering. It's possible that someone records the meter multiple times within the same period on different dates. If I want to add those values together, it seems I would need do one of the following
- fudge the date to use the
incrementfunctionality, using the difference between the last reading and current readings- aggregate all usage within the given period manually and set the usage
- pull the most recent reading saved to Stripe, and add it to the difference between the last and current readings
I'm not understanding the purpose of your example if all usage doesn't aggregate.
I just realized that I failed to set the type of metering when I re-created the product!!
https://stripe.com/docs/api/prices/object#price_object-recurring-aggregate_usage you could use last_during_period too right?
hahaha I do that mistake a lot. Or I have a price called "Metered billing" but it's not metered ๐
Oh, the option I selected isn't even the default. Wow. My bad. Alright, well, thanks for rubber ducking for me.
Sorry for the confusion. Lol.
happy to help ๐
@jade nest I'm taking over this thread, let me know if you have any follow-up question.
I think it should be good to close now ๐