#scott-subscription-unpaid

1 messages · Page 1 of 1 (latest)

boreal helmBOT
naive saffron
#

Hi!

steel copper
#

scott-subscription-unpaid

naive saffron
#

First of all, THANK YOU FOR THE AWESOME FEATURE OF TEST CLOCKS

steel copper
#

@naive saffron It depends a bit what you are after. You can list all unpaid Invoices associated with a Subscription by using https://stripe.com/docs/api/invoices/list and passing subscription: 'sub_123' and then walk back the list.

#

If your goal is to make a Subscription active again, what you need to do is pay the most recent Invoice so it'd be the one in latest_invoice: 'in_123' on the Subscription object

naive saffron
#

The problem is that the latest invoice is a new draft

#

For the next month

steel copper
#

not really no

#

the latest Invoice is always for the current month, we charge in advance

#

So you take that Invoice, finalize it and pay it

naive saffron
#

The "latest_invoice" points to a draft

steel copper
#

yes it's a draft because the Subscription is unpaid, in which case new invoices stay as draft

naive saffron
#

Is there a way to access the unpaid invoice quickly? Or I have to parse every invoice?

steel copper
#

I already explained what to do

#

there's no point getting a previous Invoice, this is the Invoice you want to pay: the most recent one

naive saffron
#

I understand

#

But my usecase is different

#

That's because I need to calculate 30 days since the unpaid invoice was finalized

steel copper
naive saffron
#

Ok!

#

Thanks

#

I'll do that

steel copper
#

sure, let me know if that doesn't work on your example

naive saffron
#

Perfect

#

Thanks and have a nice day, koopajah