#Sen-subscription-retries
1 messages ยท Page 1 of 1 (latest)
Hey! You'll want invoice.payment_failed: https://stripe.com/docs/api/events/types#event_types-invoice.payment_failed
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
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??
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.
The behaviour depends - does the payment succeed? Why not test this?
So I need to intercept more than one event when subscription recurring??
What exactly are you trying to do?
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?
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.createdinvoice.finalizedpayment_intent.createdpayment_intent.succeededcustomer.subscription.updated
But you don't need to listen for them all, which is why I asked what exactly are you trying to do
I am trying to do is if the subscription is successfully renewed, update subscription data and if renewed failed due to some reason then log that error and update subscription status inactive from my side.
Now, which event is useful as you mentioned above?
I guess you'd want customer.subscription.updated
Specifically the status & current_period_end fields
Thanks
How to know that payment is failed using customer.subscription.updated event??
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?
What do you mean by 'upgrading subscription'?
I mean switch plan from old one to new.
Again, it depends. What's the API call you're making to do that?
Yes, I have used Subscription::update() API. Also, set proration_behavior => none and billing_cycle_anchor=> now
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?
Then yes, that will invoice them immediately: https://stripe.com/docs/billing/subscriptions/upgrade-downgrade#immediate-payment
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.
That depends on if you have the retries configured
If a retry succeeds and payment is captured then the customer.subscription.updated event will fire eventually (which you're handling)
That's I looking for.
For canceling a subscription, at the priod_end then end of the period which event will run?
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.
Ah, got it. You'd be looking for customer.subscription.updated, specifically: https://stripe.com/docs/api/subscriptions/object?lang=php#subscription_object-cancel_at_period_end
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
All of this is very easy to test ๐
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.
The same events will fire
Ok
Like switches => customer.subscription.updated
deleted => customer.subscription.deleted
But which event for cancel => ???
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)
I already said when cancel from stripe dashboard
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)
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??
When are you setting the subscription to cancel via the Dashboard?
Are you cancelling it immediately? Or at the end of the period?
Or a specific date?
Sorry for the late respose. Both ways are possible.
I just want to know which webhook will trigged when above three possibility will apply.
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
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.
Nope, credit/debit is indifferent. We support most major brands: https://stripe.com/docs/payments/payment-methods/overview#cards
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?
Yep, there's no difference
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.
Yep, you will need to account for that!
Thank you mate.
You help me a lot.
Np!