#pb-PaymentIntents

1 messages · Page 1 of 1 (latest)

dawn wraith
#

but that list will only show the latest charge

sudden whale
#

Okay so the list can only have one successful charge but several unsuccessful ones before?

dawn wraith
#

my bad

#

it will show the latest charge only

sudden whale
#

But can a payment intent have several successful charges?

dawn wraith
#

not that i'm aware of

#

afaik, only one successful charge

sudden whale
#

Okay so several failed ones, but only on successful charge. However the list only shows the latest charge, whether that is failed or successful?

dawn wraith
#

yep, that's correct

sudden whale
#

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.

dawn wraith
#

you collect the payment method details then try again (i.e. confirm again)

#

If the payment attempt fails (for example due to a decline), the PaymentIntent’s status returns to requires_payment_method.

sudden whale
#

So through the API (sdk) using javascript/typescript..

stripe.paymentIntents.create({ ... });

Then if that fails...

stripe.paymentIntents.capture({ ... });

?

dawn wraith
#

can you share an example PaymentIntent id which you've created before?

sudden whale
#

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..

dawn wraith
#

alright, so, that's failed, and you can see the status is now "requires_payment_method" again

sudden whale
#

Notice this description for the ".capture" method.

dawn wraith
#

you shouldn't be using capture

sudden whale
#

Okay... so how do I retry?

dawn wraith
#

how are you planning to collect payment method details again from your customer?

sudden whale
#

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.

dawn wraith
#

alright, so you just want to try again with the same card? and not collect different card details from your customer?

sudden whale
#

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.

dawn wraith
sudden whale
#

Which the user then can change (use another default card)

dawn wraith
sudden whale
#

We do it in the backend.

dawn wraith
#

ah