#Sen-subscription-retries

1 messages ยท Page 1 of 1 (latest)

drowsy stump
pale bone
#

But when stripe subscription plan end of the period thencustomer.subscription.updated event run right? so I need to intercept invoice.payment_failed event also??

drowsy stump
pale bone
#

I have read the doc so that I am confused and decided to ask questions directly to you.
Like when the subscription period ends which event needs to intercept??
Please give me an exact event that I need to integrate while recurring.

drowsy stump
#

The behaviour depends - does the payment succeed? Why not test this?

pale bone
#

So I need to intercept more than one event when subscription recurring??

drowsy stump
#

What exactly are you trying to do?

pale bone
#

I think you have not understand my question.
Let's say I have created a weekly subscription plan and then the week elapses so which webhook events will be triggered from the stripe.
Generally, the flow is if successfully recurring done then will update subscription-related data into our system.

My question is I need to check how many events for this flow?

drowsy stump
#

I do understand your question, but the events that are sent depend on a lot of factors. So let's assume the subscription is successfully renewed:

  • invoice.created
  • invoice.finalized
  • payment_intent.created
  • payment_intent.succeeded
  • customer.subscription.updated
#

But you don't need to listen for them all, which is why I asked what exactly are you trying to do

pale bone
drowsy stump
#

I guess you'd want customer.subscription.updated

#

Specifically the status & current_period_end fields

pale bone
#

Thanks
How to know that payment is failed using customer.subscription.updated event??

drowsy stump
#

status: 'past_due'

pale bone
#

Great, now I have used 'payment_method' => 'stripeToken' when creating a customer. So when upgrading subscription with the customer, payment will automatically deducted from customer account?

drowsy stump
#

What do you mean by 'upgrading subscription'?

pale bone
#

I mean switch plan from old one to new.

drowsy stump
#

Again, it depends. What's the API call you're making to do that?

pale bone
#

Yes, I have used Subscription::update() API. Also, set proration_behavior => none and billing_cycle_anchor=> now

drowsy stump
#

Ok so as you're switching plans and the billing anchor, I guess your intention is to discard in prorations for the previous billing cycle?

drowsy stump
pale bone
# drowsy stump `status: 'past_due'`

If payment failed due to card error or declined then check status past_due But after some time stripe will try to make the payment again???
If so then This is important because when the customer solved the decline error from their end then payment will be deduced but my system does not know.

drowsy stump
#

If a retry succeeds and payment is captured then the customer.subscription.updated event will fire eventually (which you're handling)

pale bone
#

For canceling a subscription, at the priod_end then end of the period which event will run?

drowsy stump
#

customer.subscription.deleted

pale bone
# drowsy stump `customer.subscription.deleted`

This event will run end of the period not run when customers cancel at time. Suppose the customer cancel today but the period ends will after two days then customer.subscription.deleted event fired two days after.

drowsy stump
#

All of this is very easy to test ๐Ÿ™‚

pale bone
#

Thank you so much.
The last question is If the admin switches subscription or cancel or deleted from the stripe dashboard then how to handle that task?
I mean need to tell my system that some changes are occurred from the stripe and will update related data in my system you know.

drowsy stump
#

The same events will fire

pale bone
#

Ok
Like switches => customer.subscription.updated
deleted => customer.subscription.deleted
But which event for cancel => ???

drowsy stump
#

Again, depends on when it is set to cancel

#

There's no real 'delete' action - that event fires when the subscription cancels (be that immediately or at the end of billing period)

pale bone
#

I already said when cancel from stripe dashboard

drowsy stump
#

Right, but that's not a delete action as we previously discussed

#

customer.subscription.deleted only fires when it actually cancels (be that at the billing period end like you said earlier)

pale bone
#

So when stripe admin Cancel subscription as above button then customer.subscription.deleted event triggered???
I have used stripe.js for card payment fields. So credit cards will also work or only debit card works??

drowsy stump
#

When are you setting the subscription to cancel via the Dashboard?

drowsy stump
#

Are you cancelling it immediately? Or at the end of the period?

#

Or a specific date?

pale bone
#

Sorry for the late respose. Both ways are possible.

#

I just want to know which webhook will trigged when above three possibility will apply.

drowsy stump
#

Cancel immediately: customer.subscription.deleted
Cancel on specific date (or end of period): customer.subscription.updated fired immediately, followed by customer.subscription.deleted on the date you set to cancel

#

Again, this is all very easy for you to try out in test mode

pale bone
#

Ok, I will test now.
I have used stripe.js for card payment fields. Is a credit card work the same as a debit card? Or any config needed.

drowsy stump
pale bone
#

Yes, I have seen the doc. But there are no described Credit card works?
I mean like visa or Mastercard right but my visa is a debit card and Mastercard is credit. So when I will make payment through a credit card, will it work?

drowsy stump
#

Yep, there's no difference

pale bone
#

Ohh, Thank you!!
The last question is about 3DS payment authentication. Right now my site integration has not used this feature you know.
So any restriction faces in future. Like my integration not work.

drowsy stump
#

Yep, you will need to account for that!

pale bone
#

Thank you mate.
You help me a lot.

drowsy stump
#

Np!