#jeff_unexpected

1 messages ยท Page 1 of 1 (latest)

onyx timberBOT
quiet crystalBOT
#

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

onyx timberBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can 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/1260899535698268223

๐Ÿ“ Have more to share? Add details, code, screenshots, videos, etc. below.

half dune
#

๐Ÿ‘‹

if subscription ends at 12:30, metered usage between 12:00 ~ 12:30 is not being included in invoice.
But these will be included in the next invoice no ?

normal geyser
#

should I make next invoice manually? since it was final invoice of subscription?

#

I should have write it is just before subscription end into "What did you expect to happen?" too.

half dune
#

I see yes, between you are using the legacy record usage or the new billing meters ?

#

Also could you please share the Subscription Id ?

normal geyser
#

i'm using new meter api.

#

sub_1PQkSVFNf8dK0vHxtfbJuV1z
sub_1Paz93FNf8dK0vHxbcPlg1aR

#

these are subscriptions that i tried to insert the last usage.

half dune
#

Thanks for sharing, checking...

#

Actually, this is expected yes.

#

You have two options. Finalize the invoice immediatly once Stripe creates the draft in voice and disable the services from your end customer. Or keep reproting usages and issue one extra invoice for the remaining period.

onyx timberBOT
normal geyser
#

Aha, thank you for the check.

One more thing, is it also expected that reporting before invoice created also not inserted?
e.g)
reporting at = 12:01:00
reporting timestamp = 12:00:00
subscription ends and invoice creation = 12:30:00

above not inserted but timestamp 11:59:00 works.

#

if so, I will disable the service at the top of the hour before the subscription end time.

fathom plover
#

Yes, we only collate meter events reported when the subscription/invoice is actually created and exists. And events reported for that customer/price prior to that won't be collected

normal geyser
#

Oh no, I mean that 12:00:00 is in subscription period but will be end soon.

onyx timberBOT
normal geyser
#

let me put it simple, a subscription started at 00:30 and ended at 12:30.

#

i was able to insert usage at 11:59

#

but not able to put at 12:00 even it was before subscription ends.

fathom plover
#

Depends, are these aggregated events you're reporting? Is there an example?

normal geyser
#

yes it is hourly aggregated events.

normal geyser
fathom plover
#

Can you share some requests where you send meter events?

normal geyser
#

hmm ok.

sub_1Paz93FNf8dK0vHxbcPlg1aR
was ended Jul 10, 11:57 AM

curl https://api.stripe.com/v1/billing/meter_events \
    -X POST \
    -u ":" \
    -d event_name=mesa \
    -d timestamp=1723287599 \
    -d "payload[stripe_customer_id]"="cus_QRp0kktv8R6Bw0" \
    -d "payload[value]"=9


curl https://api.stripe.com/v1/billing/meter_events \
    -X POST \
    -u ":" \
    -d event_name=mesa \
    -d timestamp=1723287600 \
    -d "payload[stripe_customer_id]"="cus_QRp0kktv8R6Bw0" \
    -d "payload[value]"=1

curl https://api.stripe.com/v1/billing/meter_events \
    -X POST \
    -u ":" \
    -d event_name=mesa \
    -d timestamp=1723287601 \
    -d "payload[stripe_customer_id]"="cus_QRp0kktv8R6Bw0" \
    -d "payload[value]"=3


curl https://api.stripe.com/v1/billing/meter_events \
    -X POST \
    -u ":" \
    -d event_name=mesa \
    -d timestamp=1723291199 \
    -d "payload[stripe_customer_id]"="cus_QRp0kktv8R6Bw0" \
    -d "payload[value]"=5
#

tried above 4 curl command

#

first one was successful but others were not.

#

i mean, request were succeed but not included in invoice ๐Ÿ™‚

mossy heath
#

hey @normal geyser

#

think of the hourly aggregation as small subscription period times

#

if the period has not ended then it won't be part of the current invoice

#

does that make sense to you?

normal geyser
#

hi @mossy heath. yes I could not comment on the thread since it was closed.

mossy heath
#

no worries, we close the threads after they get idle for some time

normal geyser
#

ah, so you mean, the whole one hour should be inside the subscription period, right?

mossy heath
#

inside the invoice period right

#

aside from the subscription period, each invoice has a period as well

normal geyser
#

isn't invoice has a grace period also?

mossy heath
#

the reason why it works this way is because the hour hasn't finished yet and other events within this hour can occur, so the aggregation is still not yet "finalized" to become part of an invoice

mossy heath
normal geyser
#

for subscription period wise, I think i understood.

mossy heath
#

not the period of the invoice

normal geyser
#

yeah, I think I got it.

#

the aggregation also has to be finalized

mossy heath
#

yep!

normal geyser
#

before the subscription end

mossy heath
#

you don't really care about the subscription end

#

because there will be an invoice that will be generated after that

#

for the period that wasn't covered

normal geyser
#

oh

mossy heath
#

that's why you see the usage record in the upcoming invoice

normal geyser
#

then, if I stop the automatic finalize

#

of the invoice

#

and wait for the aggregation hour

#

then it will be included?

mossy heath
#

it depends on the invoice's period

#

not the finalized time

normal geyser
#

ah those are different.

#

aggregation should be done in invoice period

mossy heath
#

if you take for example in_1Paz93FNf8dK0vHxnTVWBYM4

normal geyser
#

that is exact

mossy heath
#

you can see the period.start and period.end on the object

#

on the line items

#

"period": {
"end": 1723287600,
"start": 1720612633
},

normal geyser
#

I see it

mossy heath
#

actually you might be right on the finalization part

#

could you try to do the same but instead of finalizing directly wait until it gets finalized after 1h?

#

you can use test clocks so you don't have to wait the 1h

normal geyser
#

sure, let me try.

mossy heath
#

ok I just did some extra tests and confirmed my initial claim

#

regardless of when the invoice is finalized

#

the important thing is whether the hour is fully part of the period of the invoice or not

#

basically if the invoice is created during the hour, the usage records of that hour won't be part of the invoice

normal geyser
#

yes unfortunately, I tried and got same result.

#

gotta find a way to charge with additional invoice or something.

#

Thank you for the long questions all guys!!

mossy heath
#

no worries

#

let me know if you need any more help