#WhySoAsync-invoice

1 messages ยท Page 1 of 1 (latest)

ancient talon
#

Hello ๐Ÿ‘‹
Do you have a request ID for invoice.pay(latest invoice id) request I can look at?

crisp linden
#

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

ancient talon
#

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?

crisp linden
#

Yes please

#

If i retry now, subscription date should be 1 june 2022 , not 29th may

ancient talon
#

do you have any example subscription as well as invoice IDs that I can look into?

crisp linden
#

in_1L3SjCDmVlmqORBIRdysnmRh

#

This is the latest succeded

#

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

ancient talon
#

Appreciate your patience
I have to step away soon so I'm getting some more eyes on this

magic venture
#

๐Ÿ‘‹ 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?

crisp linden
#

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

magic venture
#

You don't have to cancel a Subscription when payment fails

#

You can leave it in past_due

crisp linden
#

It's past due but if it retries several times it's status unpaid

magic venture
#

That is up to you and your billing settings

#

You can "leave as is" if you so desire

crisp linden
#

It can remain past due?

magic venture
#

Yes

crisp linden
#

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

magic venture
#

Right but didn't the customer have access to your product the entire time?

crisp linden
#

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

magic venture
#

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

crisp linden
#

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?

magic venture
#

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"

magic venture
crisp linden
#

How do i void the invoice?

magic venture
#

Hmm actually

#

This might still attempt to charge the customer

#

If you have charge_automatically set

crisp linden
#

Past due status remains one day?

magic venture
#

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

crisp linden
#

I'm trying to understand.

I'm paying the invoice
If successfull i will update subscription to trial until next period?

magic venture
#

Yeah let's walk through the scenario

#
  1. Invoice is generated on June 1 for June 1-30
#
  1. Invoice payment fails
#
  1. On June 5 the retry succeeds
#
  1. You update the Subscription to add a 30 day trial period from June 5-July 5
#
  1. On July 5 the trial ends and a new invoice is cut for July 5-Aug 5
crisp linden
#

Ohhhh nice, i got it, one more question.

How much status unpaid subscription remains until voided?

magic venture
#

Can you rephrase that?

#

Not sure I understand

crisp linden
#

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

magic venture
#

You dictate what happens to the Subscription when all retries fail (and how many retries will take place)

crisp linden
#

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?

magic venture
#

Yes the cycle will always remain the same unless you update the Sub

crisp linden
#

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?

magic venture
#

Yeah that would be the way to handle with automatic retries

crisp linden
#

Got it, i think i will cancel the subscription if it fails payment. ๐Ÿคฃ it's too much to do for a retry

magic venture
#

๐Ÿ˜‚

crisp linden
#

Thank you for your help and time !