#psisoyev - save card
1 messages · Page 1 of 1 (latest)
Hello! Just starting a thread for you -- I'll review and respond as soon as I can 🙂
You don't need to re-create the Payment Intent, you can /update it to change the value of setup_future_usage:
https://stripe.com/docs/api/payment_intents/update#update_payment_intent-setup_future_usage
You can then use elements.fetchUpdates() to ensure the payment element pulls the latest parameters from the payment intent.
Hello,
So the idea is to call Stripe API every time user clicks on a checkbox? Or would you call it once just before the confirmation?
Basically:
User enters card details
Checks "Save card" checkbox
Clicks on "submit" button
FE sends an update payment intent request to BE
BE updates payment intent
FE sends confirm payment request
That's up to you -- since this update has no effect until payment click (unlike say, amount), you could defer the update until they click pay.
This would mean the process should be synchronous: FE should wait until BE will update the payment intent, right? It doesn't make sense to update the intent after it was confirmed
Correct, you'd update then confirm in that case. YOu may want to kick off the update async as the option changes.