#Fred - Invoice due_date

1 messages ยท Page 1 of 1 (latest)

vernal raven
#

Do you have the ID of a specific Invoice that you are seeing this with. (in_123)?

calm lintel
#

in_1KX4AYC0QKj18akVnmwq61h9

vernal raven
#

Thank you for the ID. Will check in to it in a minute.

calm lintel
#

Thank you very much ๐Ÿ™‚ I believe this is happening with multiple of our invoices. I forgot to mention that this is the timestamp information from the webhook events

#

evt_1KX4AZC0QKj18akVunNF9smG

vernal raven
#

Interesting. So just to confirm your question: we are trying to figure out why there is a 4 week gap between finalize_at and due_date for some Invoices?

#

Are you trying to set the due date to be earlier or something?

calm lintel
#

Exactly ๐Ÿ™‚ And on the PDF invoice it seems to be the same date as the finalized at

#

I'm not even setting the due_date, because that's not possible for invoices created with collection_method=charge_automatically

mortal glade
#

Hello! It looks like this Invoice is due in 30 days (days_until_due is set to 30) so that would explain the gap, but let me see if I can figure out the date on the PDF...

calm lintel
#

I've just checked the code where this is created, and there's no days_until_due being set. Is this a default value I have to overwrite?

mortal glade
#

Oh, this is a charge automatically Invoice, so it's due immediately. Sorry, I didn't notice it wasn't an Invoice being emailed out. The days until due doesn't apply to charge automatically Invoices.

calm lintel
#

Yea exactly ๐Ÿ™‚

#

This is why it's confusing me

mortal glade
#

Wait, sorry, I think I maybe have missed something. Let me read the thread again...

#

But when I get the timestamp from the API, it's more than 4 weeks ahead of the finalize_at

Can you clarify what you mean here? Which API? Which specific property are you looking at?

calm lintel
#

Sure

I can see the due_date on the PDF being Feb 25, and that seems to be correct since it's the same time as the finalize_at.

But in the webhook events, I use the property "due_date" and it's giving me a value of March 27

#

For example this event: evt_1KX4AdC0QKj18akVikGRUKQd

#

Here's me using the same method to convert the timestamps to something readable.

Top = due_date
Bottom = finalize

mortal glade
#

Ah, okay, this is due to the API version of those events. Prior to API version 2019-10-17 the due_date property could not be null, so we had to set it to something. If you use a more recent API version this should no longer happen: https://stripe.com/docs/upgrades#2019-10-17

calm lintel
#

Okey, so because my default API version is too old, this is happening?

mortal glade
#

Yep.

calm lintel
#

This makes sense. I already control the API version with the header, but I didn't think about this for webhooks ๐Ÿ™‚ Thank you so much

mortal glade
#

Happy to help!