#pollux

1 messages · Page 1 of 1 (latest)

onyx chasmBOT
cerulean sky
#

there’s an additional five minutes after the end of a billing period when you can report usage

#

So this would be at the end of a billing period, you could listen to customer.subscription.updated to look for the billing period change

willow raft
#

I tried that, I reported the usage too, I dont see any invoice created for the additional usage quantity

onyx chasmBOT
willow raft
#

not sure if usage reporting is working

#

this is the price id price_1NDUwYGuTUZZ6Si6iT5OjXG7

cerulean sky
#

What is the subscription id?

willow raft
#

sub_1NDY8uGuTUZZ6Si6Wk0o7q3J

#

okay its looks like it worked this time? so does this mean this invoice will be collected next month?

#

it says upcomming invoice

#

why is it next month tho? i need it to be billed this month

cerulean sky
#

Note that the sub is using a test clock to "this month" and next month are relative to the clock

#

but is it the 20000 units you reported at 6:03?

#

is that timestamp in the previous billing period that just ended?

#

The grace period allows you to update usage for the billing period that ended, but you need to send usage for the correct timestamp (within that period)

willow raft
#

this was the timestamp for 20,000 units

#

1698409980

#

wait a min, timestamp is wrong

#

fixing

#

No, it was right

#

27 oct

#

im really confused

cerulean sky
#

Do you get the expected result if you shift that timestamp to be before the period end? ie, even just a second before, pushing it clearly within the earlier period

willow raft
#

is there a way to reset the clock again? and how should I advance the clock to see if this is working?

cerulean sky
#

You'd create another, time can only go forward

willow raft
#

let met see

willow raft
#

if you look at the view usage button, you can see its reported at 6:02 pm, I subtracted 60 seconds from current period end

#

it ends at 6:03

#

@cerulean sky

#

changed it to subtract 1 hour and it not even roporting usage

#

1 day sorry

charred widget
#

Hello 👋
Give me a sec to catch up here

willow raft
#

this was the error I got for 1 day prior

Cannot create the usage record with this timestamp because timestamps must be after the subscription's last invoice period (or current period start time).

charred widget
#

Can you share the request ID?

willow raft
#

req_KUFZDNCQd6xsse?t=1685478796

#

timestamp is 1 day prior

#

so it should add the usage to invoice and have billed with 50,000 units

#

i think I should add a second?

charred widget
#

yeah try it out

onyx chasmBOT
charred widget
#

To summarize ( timestamps are in UTC)

You have a test clock subscription with ID sub_1NDY8uGuTUZZ6Si6Wk0o7q3J

Currently Subscription's
period_start: 2024-04-27 12:33:00 +0000
period_end: 2024-05-27 12:33:00 +0000

When you sent a request to report the usage
https://dashboard.stripe.com/test/logs/req_KUFZDNCQd6xsse

You reported usage for 2024-04-26 12:33:00 timestamp

#

That not working is expected as you can't report usage for previous period after a new cycle has started (except for the first 5 minutes of the new cycle)