#Themax1-webhooks
1 messages ยท Page 1 of 1 (latest)
I saw that when I create a payment intent, confirm and then capture, there's a bunch of events that webhook can capture, do I need to capture all of them or there's one or two that's is more important?
or that's depend of my application?
It does depend on your application
Which confirm and capture events are you considering looking at?
payment_intent.succeeded is highly reccommended to listen to for fulfillment. If you don't listen to it, it is possible for the client side application to lose connection just after charging a customer so your server would otherwise not know that you charged them
Soo, I was thinking looking out for payment_intent.created to save some data on my DB, charge.succeeded, charge.captured and payment_intent.succeeded
what you think some of this?
for success of course, I know that's a bunch do deal with errors too
Those certainly make sense to listen to for a successful payment
Again, depends on what your app needs
Those will be redundant in a few cases but as long as your app knows what it is doing with each you are good
My app it's not that complicated, is going to work with connected accounts, but actually really simple
going to use only payment, confirm and capture
but I think I going to stick of those events
stripe provide message errors and success messages auto?
Can you clarify that last question a bit?
Yes error messages will be a part of the relevant webhooks
And are you asking if they get sent on automatic payments?
like, stripe return for me on this events error messages if it's a error and success message on events of type success
like this, success: Your payment was successful and error: Your payment has failed for this reason...
in body response I mean
and another question, let's say a credit card was declined because of expiry, but my status it's still requires_payment_method, can I try to complete the same payment intent with another card or I can just begin a new one?
Errors will not be in those events
Let me see if we have a doc on this outside of our API reference
Unfortunately I am not seeing much. The failure webhooks there would be payment_intent.failed, charge.failed, and charge.expired
hmm gotcha
one more question, It's common to save payment intentions on DB even if in the confirmation fails, just to preserve logs of payments done on the platform? or it's just a preference over a requirement? since stripe logs that for me being a plataform
That would be your preference. If the payment failing means something to you or your app, that might make sense to store but you could also reasonably determine that you don't need to.
ohh ok
the payment only fails on is charged right? in the confirm method right?
because when it creates the payment intent it doesn't have failed yet
or I'm wrong?
and my other question is about webhook, I going to use the type of the event to create a record on my DB, but I have some relationship on my DB on the payment datatable, so I have to send whats is my orderId for example, and this type of data I cannot send via webhook, because stripe doesn't have this information
what approach do you recommend doing it?
A payment intent wouldn't fail until after confirmation ๐
When you create the Payment Intent you can set this extr information as metadata, which would make it available in the webhook event
ohhh readlly
really*
i didn't know that
that's very interesting
metadata is a param that I send on the create intent right?
this metadata is for this kinda use then? I can put many params that I want too?
Yes - metadata is a great place to put this kind of information, and you can put in multiple keys (we go into detail here https://stripe.com/docs/api/metadata)
๐ happy to help!