#alexanderg-intents

1 messages · Page 1 of 1 (latest)

wind tartan
wind tartan
#

That one is in status:requires_payment_method in the API, which is not terminal. You can always attach a new PaymentMethod and attempt to process the payment again.

The terminal states are succeeded and canceled , anything else you can keep working with the state machine.
https://stripe.com/docs/payments/intents?intent=payment

#

also I'm confused a bit by that PaymentIntent, since you are creating it, getting an error, but then you retry the creation with the same idempotency key. That doesn't attempt a new charge or to process a payment(you'd want to use a different idempotency key if that's what you want), it just returns the saved API response again

deft schooner
chilly sonnet
#

I was just playing with idempotency key

#

How can I try the same failed payment intent again, but without changing the payment method, ie retry the same credit card?

#

For example the card had no funds left, but the client refilled it and I want to try to authAndCapture it again.

#

Basically I do not want to create an new payment intent but keep the same one with the same info and just try it again

deft schooner
chilly sonnet
#

Sure, I will try it out. Thank you.

#

... again what do I need to update on PaymentIntent, nothing changed from client perspective?

deft schooner
#

When a PaymentIntent fails the PaymentMethod is automatically detached and it goes into the requires_payment_method status. So at that point if you want to try the same PaymentMethod again you'd have to reattach it to the PaymentIntent and confirm it once again (preferably confirm on the client in case 3DS is required)

chilly sonnet
#

So I need to reattach the same payment method and try to confirm again and it should work if the card is good?

#

btw, at the point of reconfirm there is no manual entry from the client, just the info I have saved from the previous attempt at Stripe

deft schooner
#

It depends, if the PaymentMethod wasn't previously attached to a customer it becomes "consumed" and can't be used again if the PaymentIntent fails. In that instance you'd have to collect the card details again

chilly sonnet
#

Makes sense, so in our case the method is not attached to customer so basically we cannot reuse the same method?

deft schooner
#

@wind tartan to keep me honest here, but I'm fairly certain that if the PaymentIntent fails and the PaymentMethod wasn't previously attached to a customer it gets "consumed" and can't be used again

wind tartan
#

yes, it's consumed and you'd create a new PaymentMethod

#

in practise the way you should do this is simply catching an error on your frontend and calling confirmPayment again.

#

like you call https://stripe.com/docs/js/payment_intents/confirm_payment , catch the error , show it to the user. The user changes some details and hits the pay button, and your code calls the same function again, repeat... The function collects the payment information from the frontend elements and re-attempts payment each time you call it.