#beadle_best-practices

1 messages ¡ Page 1 of 1 (latest)

rose joltBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1395802306313715773

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

twilit abyss
gentle kayak
#

Hey Timebox. Yes, I am doing that already but some invoices don't have due_date set to None but they still show up in the past due filter.

#

I believe these are invoices that are generated by a subscription set to "automatically charge"

#

Essentially, an invoice is immediately past due upon generation if the automatic payment doens't succeed.

twilit abyss
#

In that case, the due date is effectively when it was created.

So actually_due = invoice.due_date || invoice.created

gentle kayak
#

Ok. That seems simple enough.

#

Let me check something real quick.

twilit abyss
#

Wait, they don't have due_date set to None? Does it just not exist on the object, or is it set to a value?

gentle kayak
#

This is what I am getting back from the strip api using the python sdk:

'status': 'open',
'created': 1752702519,
'currency': 'usd',
'customer': 'cus_SIHPwfiTlxvZsk',
'discount': None,
'due_date': None,
'livemode': True,
'metadata': {},
'subtotal': 2900,
'attempted': True,
'discounts': [],
'rendering': {'pdf': None,
'template': None,
'template_version': None,
'amount_tax_display': None},
'amount_due': 2900,
'period_end': 1752702481,
'test_clock': None,

#

I can provide you the entire invoice object if that is helpful

#

I think using the created date makes sense. The invoice either has a specific due date in the future or it was autogenerated with the expecatation that it would be paid immediately.

#

Some have due_date set to None and some have a due_data unix timestamp.

twilit abyss
#

Sorry, fell off my chair.

No, this is perfect.

So invoice_due_date = invoice.due_date or invoice.created

gentle kayak
#

all good

#

thanks for the help!