#xiah-metered-billing

1 messages ยท Page 1 of 1 (latest)

mystic kayak
#

I'm not sure I understand the question. What do you call "subscriptions that haven't started yet"

jade nest
#

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.

mystic kayak
#

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?

jade nest
#

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.

mystic kayak
#

And you set the exact same timestamp each time?

jade nest
#

I did not.

mystic kayak
#

then that's expected

#

I'm not sure I grasp why you use increment if you are simply passing a different timestamp each time

jade nest
#

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.

mystic kayak
#

Sure thing, let me know if you have more questions!

jade nest
#

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.

mystic kayak
#

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

jade nest
#

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

  1. fudge the date to use the increment functionality, using the difference between the last reading and current readings
  2. aggregate all usage within the given period manually and set the usage
  3. 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!!

mystic kayak
mystic kayak
jade nest
#

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.

mystic kayak
#

happy to help ๐Ÿ™‚

weary ingot
#

@jade nest I'm taking over this thread, let me know if you have any follow-up question.

jade nest
#

I think it should be good to close now ๐Ÿ‘