#BRData
1 messages · Page 1 of 1 (latest)
Hey there, you've had a few questions recently about webhook integrations. Can you please provided a very clear summary of exactly what you're trying to achieve now and what isn't doing what you expect it to do?
Right now I have a webhook that checks if the status = =requires_capture(payment was successful) - if it does then it stores a row in my database with all the information - if it doesnt then it doesnt store anything
On my frontend to show the user if the payment was successful or not I am running a loop to check my database for the row that is supposed to be inserted after the webhook call - if it is there a message is displayed saying the payment was successful (it checks the database every 250 miliseconds for 15 seconds)
Now here is where my problem is - if the 15 seconds is hit - it is still possible that stripe has not proccecced the payment and my idea is I check the status of the payment on my frontend doing this:
var service = new PaymentIntentService();
var options = new PaymentIntentGetOptions { Expand = new List<string> { "payment_method" } };
var result = service.Get(paymentIntent, options, requestOptions);
then getting result.Status and grabbing the status for example it could say "Payment Failed" or whatever stripe returns
But stripe could also return "Proccessing" if it is still proccessing I will continue to scan my database until the webhook stores something
What are the possible status's that it could show that I would need to check for
Basically I am looking for a If statement that will cover all possible stripe status if(result.Status == "Payment Failed" || result.Status == "Fraud" etc...){return "Payment Failed"} else if(result.Status == "Proccessing") { continue to scan DB for webhook storage}
You can find the possible statuses here: https://stripe.com/docs/api/payment_intents/object?lang=curl#payment_intent_object-status
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I should point out that not all payments will go through a requires_capture status step -- many payment method types do not support this auth & capture flow
Are you using only cards?
As of right now I am only using cards but I am planning on using apple pay and google pay in the future but that is it.
And I am ONLY using payment holds
Ok, sure -- those two also behave like cards
Awesome - so the main ones I should be checking for in my case are "proccessing" and "canceled" - can it ever be "requires_action"?
Along with that question ^ if a payment failed due to a card issue will the status be canceled?
Depend on how you process payments, but generally yes requires_action is possible to handle 3DS flows at the banks discretion
If you're confirming the payment intent as off_session then its expected that payments requiring 3DS would be declined with authentication_required as the code
authentication required doesnt seem to be a status that is possible in the doc you sent me
No that's a decline code, the the payment intent would be requires_payment_method in that case
Gotcha - so for payment failure I should be checking "canceled" and "requires_payment_method"
does that sound right?
It depends what you're tracking -- if you want to know about payment attempt failures then you should listen for payment_intent.payment_failed events
https://stripe.com/docs/api/events/types?lang=curl#event_types-payment_intent.payment_failed
how do I get that from this: var result = service.Get(paymentIntent, options, requestOptions);
You don't
You could look at the last_payment_error to see any decline code etc:
https://stripe.com/docs/api/payment_intents/object?lang=curl#payment_intent_object-last_payment_error
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.