#gesundheit-billing-date

1 messages · Page 1 of 1 (latest)

pale gale
wintry gazelle
#

hello

#

i know that i worded it like a "try googling it" question

#

and i think maybe using upcoming invoice is the correct way to go?

#

but i found out that the next billing date is the same as the end date of the current subscription? is that how it's supposed to be?

pale gale
#

yes, you can look at current_period_end on the Subscription

or period_start on upcoming Invoice

same as the end date of the current subscription?
Subs don't have an "end date" per se, just when the current recurring period ends, after which that field gets updated to the next recurring period end date and so on

wintry gazelle
#

gotcha. I just couldn't get my head around how current_period_end = next_billing_date. I would imagine it being current_period_end + 1= Next_billing_date

#

well anyways, thanks a lot!

pale gale
#

np!

wintry gazelle
#

round 2

#

i'm trying to use upcoming invoice to get the next billing date, but i'm getting the current period's billing date.

deep mauve
#

Do you have more specific details? What are you trying? What code are you using? what's the subscription's current period start and end, what's the invoice's period?

wintry gazelle
#

I'm trying using .NET's InvoiceService.Upcoming() with a SubscriptionId to get the upcoming invoice of the subscription (next billing cycle).

deep mauve
#

It'd help to share exact code, what you see, what you log, etc.

#

but really you're likely just misudnerstanding how period works in general

#

The Invoice's period is for the past period (previous month) and the line items are for the next period (current month) so it's all just work and you're mixing things up (everyone does so it's not just you

#

Taking an example, if you have a Subscription that renews on the first on the month, the current subscription's period is October 1st - November 1st.
The latest invoice, the one that happened on October 1st charged you for October 1st - November 1st so the invoice line items have that period. But the invoice's period is September 1st - October 1st. Because the invoice could have billed pending invoice items for the period month

#

This means that the invoice that will be created on November 1st (the upcoming one, next month) will charge for November 1st - December 1st for the subscription, but the invoice's period will still be October 1st - November 1st

#

It makes a lot of sense, once that sinks in, but in the meantime it looks broken/confusing and I am sorry for that 😦

#

If you take the time to compare the API and what you see in the Dashboard though it should make more sense

wintry gazelle
#

Because the invoice could have billed pending invoice items for the period month
Can you explain what pending invoice items are? do you mean by the items that haven't been charged yet?
also, did you mean previous instead of period?

deep mauve
#

also, did you mean previous instead of period?
yes sorry, way to make this more confusing 🤦

#

Can you explain what pending invoice items are? do you mean by the items that haven't been charged yet?
Correct. Imagine you change the subscription's quantity during the month regularly, you don't want to charge every time for the difference, so you just have pending invoice items that get bundled into the next invoice, when the new billing cycle starts

wintry gazelle
#

ahh. ok.. sorta(?) makes sense to me.

#

back to the main question though. This means that if I want to use InvoiceService.Upcoming() to get the next billing date, the absolute correct date to get is actually period_end, right?

#

since it is also the date when the next period begins

deep mauve
#

Really the next billing date is the subscription's current_period_end. That's what you need to trust

wintry gazelle
#

Well, we're trying to refer to both the upcoming amount due and the billing date.
If I refer to only the current subscription, and the user adds another seat to it,
wouldn't the subscription be unable to reflect the price change?

#

that's the main reason why i wanted to use upcoming invoice instead of subscription -- so that the amount change can also be accurately reflected.

deep mauve
#

What does created show? It should show the date at which the invoice would be created which should match what you are after

wintry gazelle
#

yeah. I was digging into it, and they do match.

#

well, i guess that's the way?

#

it's solved for now. just wanted to make sure that this is the safe and correct way to implement

deep mauve
#

If it were me I would use the Upcoming invoice to show the invoice's period and its line item and use the subscription's current_period_end for when the renewal happens. But you can use created on the Invoice for sure

wintry gazelle
#

Is it because it's the most accurate?

deep mauve
#

Sorry lost my connection and my message disappeared :shake_fist:

#

Mostly, Created used to not work many years ago, but you're on a recent API version with .NET so you're fine and just relying on created is a better flow and what I recommend in your case