#Ali-invoice

1 messages · Page 1 of 1 (latest)

ripe grove
#

@safe orchid that can happen in a few cases, the most common one is the first invoice of a subscription.

#

I'm not sure what you're trying to do, but you probably want to look at the Subscription's current_period_start and curent_period_end if you want to see when the subscription started/will next bill, not the invoice period.

safe orchid
#

whey it's happened in some cases

#

my all logics working wrong now

#

@ripe grove

ripe grove
#

do you have the in_xxx Invoice ID you are seeing this on?

safe orchid
#

in_1JprlSHswjr8bdMVvdCzAUGV

#

@ripe grove

#

@ripe grove are you checking ?

ripe grove
#

I will in a moment yes

safe orchid
#

okay i am waiting

ripe grove
#

ok I'm looking.

#

so what does "same start and end date" mean? what are you looking at?

#

can you share a screenshot or the code you use to check that, or the part of the JSON you are inspecting?

#

I guess this?

#

as I said : the most common one is the first invoice of a subscription , and that's what this is.

safe orchid
ripe grove
safe orchid
#

my logic is written
i have 2 tables 1 for subscriptions and second for invoices and i am simply running crone job after 12 hours and crone job simply retrieving all invoices against subscriptions

#

is it any bug on your side whey it's happen for 1st invoice

#

or any other specific reason i will take care of it

#

@ripe grove

ripe grove
#

it's not a bug, it's just how it works.

#

the invoice period is not meant to always be the same as the subscription period, they are different concepts.

safe orchid
#

i also have another subscription but it's working fine for this

#

@ripe grove

ripe grove
#

do you have the in_xxx Invoice ID from the other one then?

safe orchid
#

yes

ripe grove
#

can you share it please?

safe orchid
#

@ripe grove i checked this happening for all invoices

#

my due date should be 29Nov

#

now what i can do for first invoice

ripe grove
#

hm

safe orchid
#

i need to save all invoices on database

ripe grove
#

what is the 'due date'?

safe orchid
#

wit correct database

#

due date should be Nov 29 2021

#

subscription interval is 1 month

ripe grove
#

so it sounds like your concept of "due_date" should be the subscription.current_period_end.

#

like I said.

safe orchid
#

yes

ripe grove
#

you seem to think the due date is the invoice.period_end

#

as I've explained , that is not accurate. The invoice period means something else.

safe orchid
#

what is mean of invoice period end?

ripe grove
#

it's the period in which any ad-hoc invoice items were charged for.
so for example

  • a Subscription starts on Oct 1st. An invoice is generated with period_start==period_end==Oct1. ; The subscription is current_period_start=Oct1, current_period_end=Nov1
  • On Oct 15th you add a manual item(https://stripe.com/docs/billing/invoices/subscription#adding-upcoming-invoice-items).
  • On Nov 1st the subscription cycles. An invoice is generated with period_start=Oct1, period_end=Nov1 and it charges that item, plus the upcoming month amount; The subscription is current_period_start=Nov1, current_period_end=Dec1
#

in almost all cases it's the subscription's current_period_[start|end] that you actually care about for most purposes.

safe orchid
#

hmmmm

#

@ripe grove can you please confirm me last thing

#

you said it's happen in first invoice

#

now i am expecting it will never happen in other invoices mean in 2nd, 3rd, 4th and so on?

ripe grove
#

I believe that is true yes. The first invoice is special.

#

but again, the invoice period is not the same as the subscription period in general. So you probably don't even need to be looking at it.

safe orchid
#

okay i will always looks on subscription period

ripe grove
#

it's always the "previous" period, like I explained in the example above(the invoice period_end is Nov1 but the subscription current_period_end is Dec1, and I'm pretty sure it's Dec1 you care about in your logic).

safe orchid
#

okay thanks

#

but that's really weird