#torn_api

1 messages · Page 1 of 1 (latest)

fleet adderBOT
#

👋 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/1389637295635959928

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

eager ice
#

Hello there

odd mountain
#

hey bismarck

eager ice
#

Hmmm good question

#

You are saying you don't see the usage in the preview

#

But also haven't finalized the Invoice yet

odd mountain
#

correct. and if i pull the invoice object via stripe api the quantity does not reflect there either

#

but the invoice is in draft. i was thinking that it might update on finalization, but worried that it won't

eager ice
#

Gotcha, can you share the Invoice ID?

odd mountain
#

in_1RfyBwHlNjGIhsafzVqCOfAw

eager ice
#

Thanks, give me a second to look and check on the expected behavior

#

Okay yeah sorry this actually is expected -- when the Invoice is created its billing period is aligned with the Subscription. That's not based on when the Invoice finalizes. You can see this via the invoice.created Event (https://dashboard.stripe.com/events/evt_1RfyBxHlNjGIhsafYqyvicfv) or retrieving the Invoice. So it will only pick up reported usage from that period fo time.

#

So for this Invoice its billing period, regardless of when it finalizes, is from 6/1 07:00 UTC - 7/1 07:00 UTC

odd mountain
#

Yes that makes sense.
but for this period, I want to update the billing meter events.
so if I create a billing meter event on 6/15, it falls in this period, so I thought the draft invoice would reflect it

eager ice
#

Ah!

#

Didn't realize that was a backdated timestamp

#

By default, newly recorded usage appears on an invoice when it’s finalized, and not on the draft invoice.

#

So I'd recommend testing this in test mode to ensure it does appear on finalization but my understanding is that it should

odd mountain
#

ok got it thanks!
what would you recommend is quickest way to test this? i can do sandbox, test clocks or whatever

eager ice
#

Yep exactly

#

Sandbox, create Subscription, advance time to get new draft Invoice, report usage for previous period, finalize Invoice.

odd mountain
#

sweet thanks, going to try it now

#

yep it was applied when the invoice was finalized!
another quick question for you-
I would love to verify somehow the final amounts of the invoices before they get finalized to make sure the usage is setup correctly. the other key part being i have configured graduated tiers on a lot of the subs, so want to make sure they are working as expected. since the invoice itself won't show the amount, is there any trick to get this amount from the api? otherwise my plan would be to get the meter summaries for the invoice date range, and then try to apply the price to it

eager ice
#

Hmmm that is a bit tricky here if you are reporting usage during this draft period 🤔