#.suryamani

1 messages · Page 1 of 1 (latest)

lusty capeBOT
#

Hello .suryamani, we'll be with you shortly! Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
.suryamani, 3 days ago, 19 messages
.suryamani, 3 days ago, 10 messages

rare phoenix
#

Hi there, how can I help?

somber coral
#

I'm testing webhook in locally by using ebhook endpoint

#

When i testing for payment failed invoice.payment_failed and customer.subscription.updated these two events are triggered and also customer.subscription.updated event skip that invoice.payment_failed event How will i sort it down

#

I have sent emails using events

rare phoenix
#

There's no need to sort them and the webhook events are not guaranteed to arrive in the sequence of their creation time

somber coral
#

Then how i will send emails based on this events?

rare phoenix
#

Based on which event?

somber coral
#

invoice.paid,invoice.payment_failed,customer.subscription.deleted,customer.subscription.pending_update_expired,customer.subscription.updated I'm using these event to send emails based on user's action

rare phoenix
#

Why?

#

Are you sending the same email when one of the events occurs?

somber coral
#

No different emails

rare phoenix
#

When why the sequence matters in this case?

somber coral
#

When i try to fail the payment invoice.payment_failed event generates and also customer.subscription.updated event also generates, Here customer.subscription.updated event after this event generates invoice.payment_failed event skipped how will i solve it?

rare phoenix
#

I'm unclear on what problem that you want to solve here, can you be more specific?

somber coral
#

When i fail the payment firstly invoice.payment_failed event will trigger after few seconds customer.subscription.updated also triggers. Here the problem is I'm using if else condition to check events, First normally invoice.payment_failed this event check in condition after customer.subscription.updatedevent generates it directly go to the condition nd send that mail but here payment failed mail need to go unfortunately subscription updated mail have sent

#

I need to restrict customer.subscription.updatedevent when payment failed

rare phoenix
#

Then you should check the subscription data inside customer.subscription.updated and decide whether to send an email.

somber coral
#

Sorry i didn't understand what you said?

rare phoenix
#

Based on your description, you are sending email whenever customer.subscription.updated arrives, and that's why unexpected emails are sent out when customer.subscription.updated occurs due to invoice payment failure.

#

And that's why you need to handle the events properly, check the subscription data inside customer.subscription.updated and decide whether an email is needed

somber coral
#

Did you see my code?

rare phoenix
#

Yes I saw your code

somber coral
#

Here customer.subscription.updated event is unwanted when payment failed, if payment is failed invoice.payment_failed event will generate that email will send to customer but for me this customer.subscription.updated event's mail will sent

rare phoenix
#

Then you should do something in your code to not send the email if it's already sent before.

somber coral
#

Not already sent, If this customer.subscription.updated event generates it skipped other generated events

somber coral
#

@rare phoenix Are you there ?

rare phoenix
#

I'm here, do you have a follow-up question?

somber coral
#

Not already sent, If this customer.subscription.updated event generates it skipped other generated events

rare phoenix
#

I don't understand what you meant here, have you tried what I suggested?

somber coral
#

I mean When Payment was failed this invoice.payment_failed event will generate and also customer.subscription.updated event generates this customer.subscription.updated event skip other generated events

rare phoenix
#

I still struggle to understand you. Have you tried what I suggested? i.e., don't send email if it's already send. I believe this would solve your problem.

somber coral
#

Update email is sent when plan is upgrade or downgrade

rare phoenix
#

Ok, so in your handling for customer.subscription.updated, you should check the subscription's status, if it's still active, then you send email about upgrade or downgrade.

somber coral
#

After checking status put update event inside the status checking condition, I'm i right?

rare phoenix
#

I don't know what you mean'

somber coral
#

if(condition for checking status){ if (stripeEvent.Type == Events.CustomerSubscriptionUpdated){ Email for update } }

#

Did you said Like this?

rare phoenix
#

I am afraid that I can't offer step-by-step hand holding to help you code. If you are not famliar with coding, consider hiring someone who is more experienced

somber coral