#Ali-invoice
1 messages · Page 1 of 1 (latest)
@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.
do you have the in_xxx Invoice ID you are seeing this on?
I will in a moment yes
okay i am waiting
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.
the first invoice of a subscription has a period like this since the invoice period is the period just completed(which is 'nothing' for the first invoice) https://stripe.com/docs/api/invoices/object#invoice_object-period_start
as I said, maybe you want to look at the subscription current_period_end/start instead. https://stripe.com/docs/api/subscriptions/object#subscription_object-current_period_start
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
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.
do you have the in_xxx Invoice ID from the other one then?
yes
can you share it please?
@ripe grove i checked this happening for all invoices
my due date should be 29Nov
now what i can do for first invoice
hm
i need to save all invoices on database
what is the 'due date'?
wit correct database
due date should be Nov 29 2021
subscription interval is 1 month
so it sounds like your concept of "due_date" should be the subscription.current_period_end.
like I said.
yes
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.
what is mean of invoice period end?
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.
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?
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.
okay i will always looks on subscription period
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).