#pb-PaymentIntents
1 messages · Page 1 of 1 (latest)
hello! Yes, you could have unsuccessful attempts to charge before - https://stripe.com/docs/api/payment_intents/object#payment_intent_object-charges-data
but that list will only show the latest charge
Okay so the list can only have one successful charge but several unsuccessful ones before?
But can a payment intent have several successful charges?
Okay so several failed ones, but only on successful charge. However the list only shows the latest charge, whether that is failed or successful?
yep, that's correct
If that is so, then I wonder... how to I retry a charge that has failed for a paymentintent?
Because now I just create a new payment intent with same information as previous.
Which feels wrong in a way.
you collect the payment method details then try again (i.e. confirm again)
you'll want to look at this chart : https://stripe.com/docs/payments/intents
If the payment attempt fails (for example due to a decline), the PaymentIntent’s status returns to requires_payment_method.
you can use the test cards here : https://stripe.com/docs/testing
So through the API (sdk) using javascript/typescript..
stripe.paymentIntents.create({ ... });
Then if that fails...
stripe.paymentIntents.capture({ ... });
?
can you share an example PaymentIntent id which you've created before?
Do you want a PI in stripe or the code part we use to create?
Ah, an id.. sorry. w8
pi_3LT5jyIiNl9eKIib2eoTnprc
That one has failed..
alright, so, that's failed, and you can see the status is now "requires_payment_method" again
Notice this description for the ".capture" method.
you shouldn't be using capture
Okay... so how do I retry?
how are you planning to collect payment method details again from your customer?
The users has their paymentmethod stored in stripe, and we have stored the paymentmethod id that they have choosen to use to pay for the service.
alright, so you just want to try again with the same card? and not collect different card details from your customer?
At this moment we can create a new payment intent with same information and that would work.
Exactly...
But if we need to change payment method we have that information (the id of the method to be used) in our db.
what you can do is to run this API again - https://stripe.com/docs/api/payment_intents/confirm with the payment method id you want to use : https://stripe.com/docs/api/payment_intents/confirm#confirm_payment_intent-payment_method
Which the user then can change (use another default card)
if you're doing it on the frontend though, then you would run https://stripe.com/docs/js/payment_intents/confirm_card_payment
We do it in the backend.
ah