#av-savedcards

1 messages · Page 1 of 1 (latest)

leaden osprey
#

doesn't seem like there is a direct Github sample unfortunately, but https://stripe.com/docs/payments/save-during-payment?platform=web is the overall guide and covers that exactly.

If it helps, there's no actual change on the frontend, the only that that's different from the regular non-saving use cases is the arguments you pass on the backend when creating a PaymentIntent.
Let me know if anything specific is unclear

mellow lark
#

I think I've worked out the saving part using the payment element, the bit I'm not sure about is how allow the user to add a new method if it gets rejected when charging off-session.

#

Is this maybe because only cards can be changed off-session? Can google/apple pay be charged later?

leaden osprey
leaden osprey
mellow lark
leaden osprey
#

you can yes, you can re-use the same PaymentIntent until it succeeds

#

this is partly why when you charge the card offsession and it declines, the PaymentIntent detaches the card and goes to the requires_payment_method state, so you can then plug it into an existing payment page to do a retry

mellow lark
#

I'll try that! Also, in the case of authentication being required to complete the offsession payment, the sample on github uses the stripe.confirmCardPayment function instead of stripe.confirmPayment in order to let the customer authenticate. Do I need to change this to make it work with payment element?

leaden osprey
#

you'd still use confirmCardPayment I believe

#

remember, you don't actually have an Element here. It's just a page with a "press this to try again" which then attempts the payment on the saved card and can present 3D Secure, you're not recollecting a card from an Element/PaymentElement , that would be separate later if the customer's save card is not working and they want to try a different one

mellow lark
#

Thank you so much @leaden osprey , this worked. One more thing, when the payment fails and the user uses an alternative card, can I save this second card to the customer object? Using setup_future_usage doesn't seem to work as that cannot be used with off_session = true

leaden osprey
#

ah good point