#.suryamani
1 messages · Page 1 of 1 (latest)
I'm testing auto renewal using test clock
this is my code
The issue i have faced is during auto renewal if payment was failed in my log invoice.payment.failed event is generated but in my code customer.subscription.updated event is shown
If the payment fail, you most likely get both invoice.payment_failed and customer.subscription.updated. Did you enabled both of these events in your webhook endpoint?
what is the diff between these two events
they mean different things but they will both occur when a recurring invoice fails
for example the customer.subscription.updated event will happen because the subscription has moved to the next billing cycle(so it's changed), and invoice.payment_failed will happen because the invoice failed to be paid
but one developer told me because of this line var subscriptionObj = (Stripe.Subscription)stripeEvent.Data.Object; I'm not getting invoice.payment.failed event , is that true?
yes, that line doesn't make sense
you can't cast the object at that point, since you don't what it is yet
you can only do that after you check the type, for example inside the if-statement for if (stripeEvent.Type == Events.CustomerSubscriptionCreated)
this is my code see it and suggest what should i change in it
we don't write your code for you here.
happy to clarify any specific questions or clarify anything I explained previously!
I mean see my code and suggest to solve the issue Im facing