#jay-subscription-events
1 messages ยท Page 1 of 1 (latest)
๐ @wraith rune Please try to just ask your exact/detailed question upfront. No need to tag anyone to reply. What can I help you with?
Ok I want to know how many webhook events call after/during subscription payment flow
Try all of this in Test mode and then you can see exactly what happens. Way faster than asking
jay-subscription-events
https://stripe.com/docs/billing/subscriptions/webhooks#events is also likely a good read if you haven't already
See the image I generate subscription checkout out page using session code(java) which is give in stripe documentation.
Now I am paying with stripe testing card which is insufficient find it send me invoice.payment_failed event two time you see the image.
After that I paying with 4242... card that time stripe send invoice.payment_failed event first and after some event it becomes invoice.payment_succeded means payment are successfully completed.
Are you based in India?
Yes
So why stripe send first invoice.payment_failed event ๐ค
Because India has strict regulations around 3DS that make it fail and require 3DS for the next payment, doesn't really matter in this case
So I write some code in invoice.payment_failed event.
When invoice.payment_failed event are called that time that code executed
And code is save failed transaction details in our local db for failed transaction tracking.
So problem is when i make payment with 4242... card that means payment is successfully completed but that time stripe send invoice.payment_failed event first So that transaction store with failed status and after some event stripe send invoice.payment_succeded than store transaction with successfully status. So we store one transaction failed event unnecessary and I want to avoid that. Is any way to do this?
There isn't really a way other than delaying the processing of the Event and wait to see if you get a successful one after
You know any optimized and best practice to do this
no
When I make payment using stripe insufficient balance card that time stripe send two invoice.payment_failed event
So I store faield entry two time and this is unnecessary
sure but it's also not a big deal
So it is common /normal ๐ค So we move to next step.
That I am so confused why stripe send invoice.payment_failed two or more time.
I explained why earlier
Yes not a big deal but why I store unnecessary entry on my db?
I'm sorry, I'm not sure how else to answer the question. This is the behaviour, it's just an Event, it's not going to change much in the grand schemes of things
I know bro
I noticed data in invoice.payment_failed event when stripe send first invoice.payment_failed event that enclude charge = null so I avoid that means not save that entry as an failed transaction.
I know we cant avoid completely.
sure you can do that if you want
Yes if invoice.payment_failed event contains charge = null so that not considered a failed or succeed scenario. Am I right?
If you get invoice.payment_failed, the payment attempt for that Invoice failed. So yes it did not succeed since it failed. If charge: null it usually means something else caused the failure like having no payment method for example.
I'm sorry I don't really get what you are trying to get at, it seems like the same question asked many different ways when it boils down to "ingest those events or skip them and wait for the success"
See the image I mark the failed event with arrow. So that event stripe send first when subscription transaction will be failed or succeed. Ok so that invoice.payment_failed event contains charge parameter with null value.
@wraith rune I'm really sorry but what are you asking? This is again the same question I answered twice. I don't understand what part is unclear
My English weak so sorry, I am just asking that invoice.payment_failed webhook event contains charge = null so I avoid that and not store that event entry as an failed payment transaction.
Hi there ๐ taking over, as my colleague needs to step away
The event invoice.payment_failed means that the payment failed. The presence of a null Charge doesn't really matter in this context
If you're storing the status of a payment, then you would use invoice.payment_failed to update your database and mark the payment as failed
Yes I know this but please read above conversation so you understand complete scenario
I did. I don't understand which part of your question isn't answered.
This
This
There isn't really a way other than delaying the processing of the Event and wait to see if you get a successful one after
See this image stripe send invoice.payment_failed event first in every subscription transaction even that transaction will succeed.
So that invoice.payment_failed have charge = null value so avoid that and not store that invoice.payment_failed event to as an failed event in my local database
Yeah, that's intended in this context
So I avoid that to store as an failed transaction, right???
No, because there may not be a successful payment afterward
You record both and update your database with the most recent payment status
No we not updated failed payment history to succeed. Ee store failed event with failed event and succeed with succeed status So it is easy for our uses and transaction tracking
You can certainly try to do that.