#.suryamani
1 messages · Page 1 of 1 (latest)
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
Hi there, how can I help?
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
This is my code
There's no need to sort them and the webhook events are not guaranteed to arrive in the sequence of their creation time
Then how i will send emails based on this events?
Based on which event?
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
No different emails
When why the sequence matters in this case?
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?
I'm unclear on what problem that you want to solve here, can you be more specific?
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
Then you should check the subscription data inside customer.subscription.updated and decide whether to send an email.
Sorry i didn't understand what you said?
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
Did you see my code?
Yes I saw your code
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
Then you should do something in your code to not send the email if it's already sent before.
Not already sent, If this customer.subscription.updated event generates it skipped other generated events
@rare phoenix Are you there ?
I'm here, do you have a follow-up question?
Not already sent, If this customer.subscription.updated event generates it skipped other generated events
I don't understand what you meant here, have you tried what I suggested?
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
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.
Update email is sent when plan is upgrade or downgrade
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.
After checking status put update event inside the status checking condition, I'm i right?
I don't know what you mean'
if(condition for checking status){ if (stripeEvent.Type == Events.CustomerSubscriptionUpdated){ Email for update } }
Did you said Like this?
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
Not like that you said this, so I'm asking like this or not?