#torn_api
1 messages · Page 1 of 1 (latest)
👋 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.
Hello there
hey bismarck
Hmmm good question
You are saying you don't see the usage in the preview
But also haven't finalized the Invoice yet
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
Gotcha, can you share the Invoice ID?
in_1RfyBwHlNjGIhsafzVqCOfAw
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
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
Ah!
Didn't realize that was a backdated timestamp
Hmm okay I think it is this: https://docs.stripe.com/billing/subscriptions/usage-based/configure-grace-period#add-usage-to-draft-invoices
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
ok got it thanks!
what would you recommend is quickest way to test this? i can do sandbox, test clocks or whatever
Yep exactly
Sandbox, create Subscription, advance time to get new draft Invoice, report usage for previous period, finalize Invoice.
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
Hmmm that is a bit tricky here if you are reporting usage during this draft period 🤔
I don't think the Preview Invoice endpoint (https://docs.stripe.com/api/invoices/create_preview?api-version=2025-05-28.preview) would work in this case but that would typically be the way you would figure that out.