#dave_73622
1 messages ยท Page 1 of 1 (latest)
thank you
Also could you share the Subscription ID (sub_xxx) that didn't move back to active?
Based on ths documentation, what you mentioned should work
To move the subscription to active, pay the most recent invoice before its due date.
here is the sub ID - sub_1O2wgoFe0xhDYvQfCnFZsWD1
its a test mode subscription. all invoices are paid, but the status remains "past_due"
Hi there ๐ jumping in as my teammate needs to step away soon. I'm taking a closer look at that Subscription.
That Subscription didn't change back to active because it's most recent Invoice hasn't been actioned, which is the requirement to move a past_due Subscription back to an active state:
https://stripe.com/docs/billing/subscriptions/overview#unpaid-subscriptions
That Subscription generated a new draft Invoice while it was past due, so that most recent Invoice must be finalized and paid to cause the Subscription to become active again.
The Invoice can't be finalized from the Customer Portal, that is something you will need to trigger from your code before sending your customer to the portal.
but that invoice isnt due yet. why does the customer need to pay an invoice that's due in the future to get the status. back to active?
What do you mean that Invoice isn't due yet? Our Subscriptions trigger payment at the beginning of the billing period, so that Invoice was generated when a new billing period started.
but its not technically due for payment until Aug 30, and the test clock is set to Aug 1
i must not be understanding something.
The dashboard is showing when the next Invoice will be generated, but the Invoice generated on July 30th is still in a draft state. That Invoice from 7/30 is the one that needs to be actioned. You can get its ID from the latest_invoice field on the Subscription object:
https://stripe.com/docs/api/subscriptions/object#subscription_object-latest_invoice
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
so an invoice can be paid even when its in a draft state?
because the July 30 invoice is showing that its been paid
No, the Invoice has to be finalized first. What is the ID of the Invoice you're looking at?
in_1O4OgpFe0xhDYvQfYWF3Ta33
That's the one from June 30th
oh.
so where is the one from July 30th
oh ok i found it
in_1O4OkGFe0xhDYvQfeyiOBO8B
so i need to finalize this one programatically before they enter the billing portal?
Correct
ok.. im trying to understand the flow here..
the customers card fails ->
the sub becomes past due ->
i see the sub status as past due when they login to my app and block them from our services ->
i also detect a past due invoice and finalize it in my code ->
then i direct them to the billing portal to pay the invoice and reactivate their subscription
something like that?
Most of that is right, but this part isn't necessarily right:
i also detect a past due invoice and finalize it in my code ->
The condition for causing the Subscription to go active again is that it's latest_invoice gets paid. That Invoice may be past due, or it may still be in a draft state, it depends on the timing and how you have your Subscription settings configured.
basically, i just want them to be able to pay all of their invoices they need to pay to get the subscription back into an active state via the billing portal.
i just want to direct them to the billing portal when they have unpaid invoice(s) and allow them to pay them there and return to the application.
what settings do i need to turn on to allow that flow?
for example - this is what the billing portal looks like for the test customer attached to the subscription we're looking at. there is no indication of a past due invoice here for them to pay
There isn't a setting for that, you need to code that flow. The main thing you need to do, is ensure all of the Invoices have been finalized and send the customer to the portal. The reason I was trying to emphasize the specific condition for triggering the Subscription to move back to an active status, is because with an approach of letting the Customer choose what order to pay their Invoices in, they may pay the most recent first and cause the Subscription to become active without paying the past due invoices.
The Invoice isn't past due, the Subscription is.
The Invoice from July is still in a draft state, so it's expected to not be shown there. Customers aren't shown draft Invoices, only finalized ones that are ready to be paid.
So if a customer can't pay an invoice due to insuffienct funds or other payment issues, the invoice moves into a draft state?
Nope, not at all.
What happened here is,
- A previous invoice went past due, so the Subscription went past due
- While past due, time advanced, so the Subscription created it's next Invoice in a draft state when it moved to the next billing period (expected behavior for past due Subscriptions: https://stripe.com/docs/billing/subscriptions/overview#unpaid-subscriptions)
- The past due Invoices were paid, but the most recent Invoice was left in a draft state and is therefore unpaid, so the Subscription remains past due.
ok
so before i generate a billing portal, i need to call some stripe APIs to finalize all draft invoices
if they exist
Correct