#tonytangplanity
1 messages · Page 1 of 1 (latest)
Hi there!
This is the API request to confirm the payment that the Terminal device made: https://dashboard.stripe.com/logs/req_ZEpNQdSKeMOJmw
As you can see, it returned an error.
So there may be an issue in your integration where you don't handle errors correctly
I tried to replicate the error with this card : 4000000000009995
As explained here : https://stripe.com/docs/terminal/references/testing#test-cards-for-specific-error-cases
It returns a failed payment with insuficient_funds. But our app is handling well the error. Do you think there's another card that I can use to have the exact same error ?
Also, could the error come from the card reader ?
Hi! I'm taking over from my colleague. Please, give me a moment to catch up.
Our app considered the payment successful
Could you please elaborate on this? What does it mean? Do you have logs the confirm this?
In our database, the payment is marked as successful. As if there was no error during the payment process. I will look for the logs.
How are you getting payment statuses to your database? Are you using webhooks? https://stripe.com/docs/webhooks
I don't believe we're using the webhook. I'm waiting for confirmation from my colleague. I looked at the logs and apparently no error was thrown from Stripe. We're using the stripe library from npm.
The creation of the payment intent did not throw any error and then our app considered the payment as successful
This is wrong, as you should never rely on anything other than the webhook notifications to tell your business logic that a payment was successful or not. Please go through the guide I shared above an let me know if you run into any issues.
So yes, I confirm we're not using the webhook. We're using capturePaymentIntent from the stripe library. Should we still use the webhook ?
These are 2 different things. With capturePaymentIntent you perform an action, and send a request to Stripe. After we process the payment you will get a webhook event notification payment_intent.succeeded (or payment_intent.payment_failed). This is the recommended flow of information.
Alright. And just so I understand correctly, capturePaymentIntent does throw an error sometimes right ? But we cannot trust it to throw en error every single time ? That's why we must use the webhook ?
Rather the oposite, it might look like the request was successful but the payment failed. That's why you should look out for those payment_intent.payment_failed webhook events. But also, only fulfill your orders when you receive the payment_intent.succeeded event.
Alright, that's clear to me now. Thank you !
Happy to help!