#WhySoAsync-invoice
1 messages ยท Page 1 of 1 (latest)
Hello ๐
Do you have a request ID for invoice.pay(latest invoice id) request I can look at?
i don't have at the moment unfortunately, i'm not at my pc.
The thing is that if latest invoice payment failed, it remains at that date.
If i hit retry button after 3 days after i change the payment method with a good one, it will pay the invoice but the start date of subscription will remain 3 days ago, and the user looses 3 days of subscription
I need to put the start date of the subscription to the moment of hitting the retry and invoice.pay()
Not latest_invoice
So would i need to create a fresh invoice then attach it to subscription and pay it after?
I searched for a param for invoice.pay() but couldn't find to refresh date of invoice for the moment pf hitting retry button
Okay so correct me if I'm wrong
You have a Subscription, let's call it X
- X's monthly renewal payment fails which was on Y date
- Latest invoice on the subscription is
past_due(date on the invoice is Y) - Now when you change the payment method and retry paying the invoice on Z date, subscription start date remains on Y date
You want subscription start date to be on Z date?
do you have any example subscription as well as invoice IDs that I can look into?
in_1L3SjCDmVlmqORBIRdysnmRh
This is the latest succeded
I have a test clock on monthly@gmail.com
But i have cancel on period end
I had some tries on that account maybe you can find it there
If not when i get home i will trigger a fail payment and status unpaid, advance clock 3 days, and then retry then
Appreciate your patience
I have to step away soon so I'm getting some more eyes on this
๐ stepping in here.
This would be somewhat messy to accomplish what you want -- it basically takes updating the sub and setting the billing_cycle_anchor to now when a successful payment is made. You would then disable prorations and void the new invoice that will be cut from changing the anchor. What's the reasoning behind wanting this behavior?
Well..if user has a card without money.
Invoice pay fails.
Few days pass and status is unpaid, how do you reactivate the subscription?
With a retry button, that does something to reactivate the subscription on the moment you press retry right?
Not reactivate subscription with an invoice that has a date from 4-5 days ago
You don't have to cancel a Subscription when payment fails
You can leave it in past_due
It's past due but if it retries several times it's status unpaid
That is up to you and your billing settings
You can "leave as is" if you so desire
It can remain past due?
Yes
But even if it remains past due, latest_invoice is still 28th may, and if i press retry now, it wont be 1st june, it will have start date 28th may
Right but didn't the customer have access to your product the entire time?
He had acces until 28th, until the payment needed to be done for 28th may -27th june
If his payment failed
He has the subscription but it's unpaid
No longer have accesss to the app's functionality
In order to get access again he needs to reactivate, but he can reactivate in 3 days
Subscription needs to start at the retry press time
In that case I would just create a new Subscription
The other option is what I mentioned above
You wait for successful payment, you update the Subscription and reset the anchor, and you void the new invoice
So if invoice fails, i just don't show subscription anymore, i give gim the choices to create another
If i void the new invoice, will i have it in latest_invoice?
Up to you but that's likely what I would do. If they no longer have access to the product then the Subscription would be "canceled"
Yes that voided invoice would be the latest_invoice
How do i void the invoice?
Hmm actually
This might still attempt to charge the customer
If you have charge_automatically set
Past due status remains one day?
Actually I thought of a different way
Instead of doing what I mentioned above, I would just update the Subscription to add a trial period until the next cycle
That will avoid a new invoice being cut from setting the billing_cycle_anchor to now
I'm trying to understand.
I'm paying the invoice
If successfull i will update subscription to trial until next period?
Yeah let's walk through the scenario
- Invoice is generated on June 1 for June 1-30
- Invoice payment fails
- On June 5 the retry succeeds
- You update the Subscription to add a 30 day trial period from June 5-July 5
- On July 5 the trial ends and a new invoice is cut for July 5-Aug 5
Ohhhh nice, i got it, one more question.
How much status unpaid subscription remains until voided?
When invoice fails on June 1, and status become unpaid.
How much time will pass until that subscription is deleted automatically and user needs to create another
I'm thinking on a case where a user forgets to pay for several months
That is up to your Billing Settings that you set in your Dashboard here: https://dashboard.stripe.com/settings/billing/automatic
You dictate what happens to the Subscription when all retries fail (and how many retries will take place)
Got it !
Thank your help !! I know what to do now
If i set retry one day after previous atte pt, if the only retry is successfull , what date will be start date on subscription?
If it's done by stripe automatically retry
The day before?
Yes the cycle will always remain the same unless you update the Sub
So i need to catch that on webhook and add trial from invoiceDate + 1 day to 30 days from the time of succesfull invoice payment that was triggered through webhook?
Yeah that would be the way to handle with automatic retries
Got it, i think i will cancel the subscription if it fails payment. ๐คฃ it's too much to do for a retry
๐
Thank you for your help and time !