Stripe Invoice. Start/created and End date are all the same for first invoice

Question!

I am getting back the invoices from my API, and I am noticing that if there are 2 full month billing cycles, all good - but I always get back one in which the start/end and created dates are the same.

So, I end up displaying it and it makes no sense.. ie.

Lets say a user created an account on July 19, 2016.. for one of the invoices (the others are good), I am getting this.

amount: 0
billingDate:"2016-07-19T23:20:33.000Z"
endDate:"2016-07-19T23:20:33.000Z"
startDate:"2016-07-19T23:20:33.000Z"

How should I handle this, or how is this a valid response? Keep in mind my billing is on the 8th. I am just a little afraid :-), to omit it if the start/end/created date are all the same.



Answers

The current_period_end and current_period_start corresponds to the period the invoice is for. As a rule on Stripe's end, the invoice is always for the "previous" period while the line item for the subscription is always for the new month.

This means that if you have a monthly subscription on the 1st of the month, the invoice on the 1st of November will be for the 1st of October until the 1st of November while the line item for the subscription will be for 1st of November to the 1st of December.

There is an exception which is for the first invoice. Since there is no "past" for the invoice, current_period_end and current_period_start will be equal in that situation and correspond to the date the subscription was created.

I'd recommend using the subscription's line item's period instead if you're displaying a date for the period the invoice corresponds to.

By : koopajah


This video can help you solving your question :)
By: admin