#Éamonn-paymentintent

1 messages · Page 1 of 1 (latest)

drowsy bison
#

@twin flax do you have the PaymentIntent ID pi_xxx that happens on?

twin flax
#

I don't - I'm using one of Stripe's test card numbers (per our previous chat :))

#

Hang on....

#

pi_3JY6CpHFmz5igbJr1shawiJw

drowsy bison
#

in that case the PaymentIntent got cancelled by your code(or the plugin you use) before trying to make that authentication

twin flax
#

@drowsy bison "No such payment_intent". I don't get how it would be cancelled. I don't use a plugin; I mound the card object, and then submit the card, which is when I get the error...

drowsy bison
#

if you're getting a "no such" error you must be logged into a different Stripe account?

#

then 25 seconds later you tried paying it on your frontend web page and you get the error you mentioned above about being in the wrong state, since you had cancelled the PI before trying to pay it so that's expected.

twin flax
#

This is wierd. Here's the exact code submitting the card:
stripe.handleCardPayment(pi_response.client_secret, card).then(function(result)
{
pay_now_btn.prop('disabled', false);
btn.prop('disabled', false);

                    if(result.error)
                    {
                        cancel_payment_intent(pi_response.id);
                        // etc.

You can see the call (to my PHP script) to cancel the PI in the event of an error, but not before. Is there some timing issue here?

drowsy bison
#

hard for me to say as I did not write your code and don't have much context beyond the logs I can see I'm afraid. I would start by searching your codebase for the exact code that cancels PaymentIntents in the backend(PaymentIntent::cancel or ->cancel( might be good search strings) and then trace where that code can be called from — is it just the frontend or is there somewhere else?

#

for example something I see sometimes is folks have a webhook endpoint which takes an action like this and they've forgotten they have that endpoint set up