#jasonkuhrt_api

1 messages ¡ Page 1 of 1 (latest)

late zincBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1235293434684768298

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

limpid junco
#

It sounds like the error message is fairly clear. Have you tried passing a timestamp for after the last invoice period?

pale willow
#

The error message is clear in theory. But another subscription will receive a usage record for the exact same timestamp. Why?

#

While here though, is it wrong that at <date>T11:59:59:999 we run a cron to capture usage and report a usage record. On the last day of the billing cycle, it is normal that a usage record will be send after the billing cycle technically, is it not?

#

Here is the "other subscription" I'm referring to for example: req_LOaXfIc3gYxkCt

limpid junco
pale willow
#

Why does req_LOaXfIc3gYxkCt succeed but req_ZQ15QKbNDYHxEN fails.

#

The invoice periods are the same. See screenshot. The billing anchor is identical.

#

We pulled down the subscription objects of both because we were confused, looking for a meaningful difference, found none.

#

The fact that each subscription started on a different day in April seems irrelevant to me. Am I wrong to think that?

limpid junco
#

Huh... that's a good point. Let me check in with my team to dig a bit deeper

cyan ledgeBOT
limpid junco
#

Just checking in to let you know we're still looking into this. @snow smelt is taking over though, so he'll circle back once we have a more meaningful update

pale willow
#

Great, thanks

limpid junco
#

Just so I understand: the new period starts on 1714521600 for both Subscriptions, so why are you passing in 1714521599 to your usage record POST requests?

#

I agree that it's odd that it works in one case and not the other, so I'm still looking into why that is, but I would actually expect it to fail for both requests

pale willow
#

Hey

#

I agree that it's odd that it works in one case and not the other, so I'm still looking into why that is, but I would actually expect it to fail for both requests
Ah I see, ok that's good to know.

#

Just so I understand: the new period starts on 1714521600 for both Subscriptions, so why are you passing in 1714521599 to your usage record POST requests?
This is because the usage is for the 24 period between April 30 00:00:00 to 23:59:999.

#

So example: Once May 1 00:00:00 occurs is it supposed to be impossible to send usage records for any timestamp in April?

limpid junco
#

Yes, because at the end of the billing period, Stripe automatically calculates the total price and invoices for all usage during that billing period.

#

That being said, I seem to recall that there was a grace period of 5 minutes for the old usage reporting. Are you migrating your usage-based Billing system from the legacy model (https://docs.stripe.com/billing/subscriptions/usage-based-legacy) to the current model (https://docs.stripe.com/billing/subscriptions/usage-based/implementation-guide) by chance?

SaaS usage-based billing made easy with Stripe Billing

Understand the major pieces of a usage-based billing integration.

#

Or have you recently implemented the new usage-based billing model?

pale willow
#

That being said, I seem to recall that there was a grace period of 5 minutes for the old usage reporting.
I think I remember this too. Is that documented?

#

Are you migrating your usage-based Billing system from the legacy model (https://docs.stripe.com/billing/subscriptions/usage-based-legacy) to the current model (https://docs.stripe.com/billing/subscriptions/usage-based/implementation-guide) by chance?
We would like to, but no immediate plans right now. Is there a benefit it brings in regards to this issue?

SaaS usage-based billing made easy with Stripe Billing

Understand the major pieces of a usage-based billing integration.

limpid junco
# pale willow > That being said, I seem to recall that there was a grace period of 5 minutes f...

I'm looking around for it, but I can only find reference in this StackOverflow thread: https://stackoverflow.com/a/73853206/18637382 it was probably something we did at one point and then changed later on, but I'm not sure

limpid junco
pale willow
#

So at the end of a billing period, it feels a bit risky to try and get the usage all calculated before the end of the cycle. We have a cron set to run, but it can take time to go through all system usage, or if any fail, a retry may come in hours time.

limpid junco
pale willow
#

Ah it has one hour grace period

#

What does

Collect usage before creating a subscription
mean, or rather, why

limpid junco
#

Some edge-case where there's a reason to aggregate usage before the customer commits to a subscription, I would guess.

#

Summary: sales things probably

pale willow
#

There is another issue we did not understand. Why does the usage record April 30 23:59 show up for the May invoice :/

#

It seems that the April invoice stops at April 29 23:59. Why is that?

hot owl
#

Helping look into this

hot owl
pale willow
#

Yeah

#

usage rec req id req_PaM0IryJu4aKem

#

there is no invoice yet, its the upcoming for sub_1P4m9FIhnflvQVbiPuFL6LBF

hot owl
#

Assuming that's because when you created that usage record it was already May

#

Not sure why one of those requests succeeded and the other failed though

#

I think at this point we need the owning team to investigate this issue

#

So, I recommend writing into support, providing both requests (the successful one and the one that failed) and asking why one succeeded and the other failed. Can you mention my username codename_duchess in the email and ping here once you've written in? That way I can loop in the proper folks to investigate

pale willow
#

When sending a usage record, I thought the timestamp determines the billing period it becomes part of.

hot owl
#
hot owl
#

As far as I know

pale willow
#

Ok

#

We'll reach out to support and then return to this thread when we get a reply. Thanks.

hot owl
#

No not when you get a reply

#

Just ping here once you've written in

#

That way I can find the ticket and loop in the proper folks

#

Then, you'll receive further support via that email ticket

pale willow
#

Ah gotchya

#

Ok I submitted

hot owl
#

What's your account id?

pale willow
#

I forgot to mention codename_duchess

#

It is ...

hot owl
#

That's fine. What's the account id I can get it from that

pale willow
#

acct_1Kec6HIhnflvQVbi