#dpelkey98
1 messages ยท Page 1 of 1 (latest)
I think it should but am not 100% sure. Are you seeing strange behavior when you call confirmPayment on a requires_action payment?
Is this related to the error from yesterday?
Nono, error from yesterday is wrapped up ๐
I am also not sure if it is strange behavior or not. I am making and confirming a payment using the 4242 card, but the payment intent returns with requires_confirmation. Per the docs that isn't supposed to happen with that card, but it also brought up my question above.
Glad to hear this is a new problem. Can you send me the ID of the PaymentIntent?
Thank you, checking in to that ID
Awesome, thanks!
return stripe.paymentIntents.create({
amount,
currency: 'gbp',
customer: customerId,
payment_method: paymentMethodId
})
This is how the payment intent was created.
Then confirmed with confirmPayment(client_secret)
Ah, requires_confirmation is actually the expected status in this scenario, that is the status for an intent that has a payment method but has not yet been confirmed
https://stripe.com/docs/payments/paymentintents/lifecycle
If you pass confirm: true when creating the intent, it will automatically try to confirm the intent which can move it to the suceeded or requires_action states
If I confirm on front-end do I still need to set confirm=true?
As in calling confirmPayment right after the intent is created?
No, you can definitely just make the call that you are already making and then call confirmPayment client-side
With the call that you are currently making, the status should always be requires_confirmation when you provide a payment method. requires_action will not happen because that status can only happen after the intent is confirmed.
Your flow should work. If you pass a requires_confirmation payment intent to the frontend and call confirmPayment on it, Stripe.js will automatically handle 3DS if need be
Gotcha, so in the case of me using confirmPayment on the provided intent and it still having the status requires_confirmation?
Would that have anything to do with the 4242 card being an America test card and charging in GBP?
It would only go back to a requires_confirmation if you have confirmation_method set to manual which is something you would be explicitly passing in the create call
To clarify, requires_confirmation is expected on creation for any intent when you give it a payment method but have not confirmed yet. That status doesn't have anything to do with 3DS because 3DS is later in the process after confirmation. Certain flows where confirmation_method: manual is set can go back to that status but that isn't what you are doing here.
Is confirmPayment supposed to handle both?
re, confirming the payment and verify 3ds?
Yes, it automatically handles 3DS if the confirmed intent comes back with a requires_action status
Alrighty, maybe I am just missing some error handling for it. Not sure why it is still requires_confirmation after using confirmPayment. Is it possible to use confirmPayment on it a second time?
Can you send me an ID of a PaymentIntent that has stayed in requires_confirmation after calling confirmPayment? On the intent that you sent before, I only saw a creation request, no confirm calls
Ah gotcha. What response do you get when you call confirmPayment client-side?
I've adjusted my code since. I'm not sure what happened. Maybe I unmounted the component before it could be confirmed or something. I just tried again with the same payment method and it worked
I'll just leave it at that so I don't take up more of your time. Feel bad bothering wth such silly issues lol
But as a general rule of thumb, if something happens due to my error and a payment intent gets hung on requires_confirmation, that payment intent's client_secret can be sent through confirmPayment at any time?
Yes, that should definitely be fine to call as long as the intent is in that state.
Ok, awesome.
And one more question while I'm here. If a payment intent fails with requires_payment_method. Is it common practice to update the payment method and confirm again on the same intent, or should I be creating a new intent?
Yes, re-using the same intent is the common/expected path here
That is actually part of why payment intents exist. They are a state machine to help track potentially multiple payment attempts for the same payment
Understood. Thanks for your help. Again... ๐