#Nick-subscription-error
1 messages · Page 1 of 1 (latest)
Upcoming invoices don't have ID's, do they?
Thanks!
So is this a one off payment or are you trying to charge for that upcoming balance or something?
I'm trying to get an invoice into draft state so I can simulate the invoice lifecycle that happens if the period ended
Basically, we report usage records every day, for the previous day. We're on a 1st -> 1st billing cycle, but on the 1st I can't report usage for the previous day because it goes to the next invoice, so I need to update the draft invoice. I am trying to write the code to do this but can't get an invoice in draft that I can then update to test my code
It's almost like stripe doesn't see a metered price as a line item? When I try to create an invoice through the UI, it only lists regular prices, even if you try to add a metered price by price_id it doesn't work
Hey, apologies it is taking me a bit on this. So as you are running in to, adding metered usage outside of the current billing period results in an error https://stripe.com/docs/billing/subscriptions/metered-billing#reporting-usage
Unless you have aggregate_usage=sum in which case you have a five minute period to record usage after the subscription cycle
After that we recommend adding the usage as line items to that draft invoice
Unfortunately still a bit unclear on the best way to test this
The problem with this is that you can't add a recurring price to an invoice. Can you update the quantity of a metered invoice item on a draft invoice?
I'd try it myself but can't get an invoice in draft haha
Unfortunately you would need to calculate the invoice item price yourself when doing this.
Got it. Any luck on how to get a draft invoice?
Can I do something like disable auto-advance system wide and then just do a billing_cycle_anchor=now or something like that?
👋 Give me a minute to catch up!
So what you're trying to do won't work (it doesn't matter if it's metered or licensesd) - at that point in time, no Invoice Items have actually been created for the Subscription so there's nothing to Invoice
Are you just trying to get in a state where there is a draft Invoice that's tied to a Subscription?
Yeah like right now if I do billing_cycle_anchor=now it will turn the upcoming invoice into a finalized invoice like this one: https://dashboard.stripe.com/test/invoices/in_1JwpIfI67GP2qpb4NlSzXLeM
But I want it to move into a draft state not a finalized state
The regular subscription/invoice lifecycle for automated invoices moves upcoming into a draft invoice, and from there I can disable auto_advance, but when I manually force an invoice to be created (through billing_cycle_anchor, product changes, etc) it instantly finalizes the invoice
Yeah I don't think there's a way for you to get around the instant finalization of the Invoice from a Subscription update (or at least I can't think of one off the top of my head). Have you tried setting trial_end a few seconds in the future?
That seems to have worked. So just to confirm, I can't update the quantity on these invoice line items?
I don't see any invoiceitem ID's in the invoice payload. Just unique_id's like this:il_1JwruII67GP2qpb4KGKDnWaD
Do you have the Invoice ID so I can take a look?
in_1JwruII67GP2qpb4U6gnsRf7
Is it just because both items were for a trial period?
Because in that case I guess trial_end won't necessarily work for getting the draft invoice I guess
I need help getting my payment info updated
@stiff river I already left an answer for you in your thread - please contact support
i do not know how use this and this customer service with stripes is horrible]
Sorry about that - @maiden sinew are you trying to update the quantity of the Invoice item for metered billing? Is there a specific reason you're doing that? I don't think that's possible....
no worries
Yeah so we basically report usage daily based on the max number of users were active on that day - we can't know the max number until the day is over, so the usage is reported at 1:30 AM UTC for the previous day (automated job on our side). On the "billing day" where the invoice moves into draft, we can't report usage for that day anymore because it's no longer part of that period
For ex: Nov 1, 2 users
Nov 2 @ 1:30AM UTC, reports "2" as usage record quantity to stripe
etc etc
Nov 30, 2 users
(billing_cycle_anchor is 1st of the month, so at 12AM UTC Dec 1, upcoming invoice moves to draft)
Dec 1 @ 1:30AM UTC, tries to report "2" but it can't because you can't report usage outside the current billing interval
So on Dec 1 I'd like to be able to update the invoice line item with the missing usage from Nov 30