#.suryamani

1 messages · Page 1 of 1 (latest)

elder juncoBOT
lusty dagger
#

Hi there!

#

How can I help?

radiant patio
#

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

lusty dagger
#

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?

radiant patio
#

what is the diff between these two events

elder juncoBOT
wary nova
#

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

radiant patio
#

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?

wary nova
#

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)

radiant patio
wary nova
#

we don't write your code for you here.

#

happy to clarify any specific questions or clarify anything I explained previously!

radiant patio
#

I mean see my code and suggest to solve the issue Im facing