#jay-subscription-events

1 messages ยท Page 1 of 1 (latest)

sacred muralBOT
tiny linden
#

๐Ÿ‘‹ @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?

wraith rune
#

Ok I want to know how many webhook events call after/during subscription payment flow

tiny linden
#

Try all of this in Test mode and then you can see exactly what happens. Way faster than asking

#

jay-subscription-events

wraith rune
#

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.

tiny linden
#

Are you based in India?

wraith rune
#

So why stripe send first invoice.payment_failed event ๐Ÿค”

tiny linden
#

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

wraith rune
#

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?

tiny linden
#

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

wraith rune
#

You know any optimized and best practice to do this

tiny linden
#

no

wraith rune
#

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

tiny linden
#

sure but it's also not a big deal

wraith rune
tiny linden
#

I explained why earlier

wraith rune
tiny linden
#

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

wraith rune
#

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.

tiny linden
#

sure you can do that if you want

wraith rune
#

Yes if invoice.payment_failed event contains charge = null so that not considered a failed or succeed scenario. Am I right?

tiny linden
#

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"

wraith rune
#

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.

tiny linden
#

@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

wraith rune
#

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.

sacred muralBOT
bleak tartan
#

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

wraith rune
bleak tartan
#

I did. I don't understand which part of your question isn't answered.

bleak tartan
#

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

wraith rune
bleak tartan
#

Yeah, that's intended in this context

wraith rune
bleak tartan
#

No, because there may not be a successful payment afterward

#

You record both and update your database with the most recent payment status

wraith rune
#

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

bleak tartan
#

You can certainly try to do that.

wraith rune
#

But when stripe send invoice.payment_failed event initially with charge = null so we avoid that and not store that transaction.

#

This is right way?