#Nick-subscription-error

1 messages · Page 1 of 1 (latest)

void pollen
#

What is the invoice ID?

#

Upcoming invoice, that is

maiden sinew
#

Upcoming invoices don't have ID's, do they?

void pollen
#

Whoops that was an assumption

#

Still looking at this error, one minute

maiden sinew
#

Thanks!

void pollen
#

So is this a one off payment or are you trying to charge for that upcoming balance or something?

maiden sinew
#

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

maiden sinew
#

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

void pollen
#

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

maiden sinew
#

I'd try it myself but can't get an invoice in draft haha

void pollen
#

Unfortunately you would need to calculate the invoice item price yourself when doing this.

maiden sinew
#

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?

half helm
#

👋 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?

maiden sinew
#

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

half helm
#

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?

maiden sinew
#

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

half helm
#

Do you have the Invoice ID so I can take a look?

maiden sinew
#

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

stiff river
#

I need help getting my payment info updated

half helm
#

@stiff river I already left an answer for you in your thread - please contact support

stiff river
#

i do not know how use this and this customer service with stripes is horrible]

half helm
#

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....

maiden sinew
#

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