#Pain Payment Methods
1 messages ยท Page 1 of 1 (latest)
Hi ๐
I'm not clear what you mean about add an option for collecting payment. The process documented there is intended to collect payment at the same time it saves the Payment Method
What would be the best way to add an option (e.g. toggle "Save my payment method"), would I have to save this payment method myself afterwards?
Because I want them to be able to use it initially to pay for something, but also have an option that allows the user to save their card (when adding the card)
e.g. Instead of this message I wish to add a toggle myself so the end-user can decide whether to save it or not
Does Stripe have something like this with Stripe Elements or must I integrate it myself below the iframe?
Okay so the setting that triggers this is the setup_future_usage='off_session',
You could change this and update the Payment Intent based on a toggle switch
But you would need to create the toggle switch and the server<-> client communication
What I was thinking initially to do is:
Create the payment intent as usual for the stripe elements
Add a Toggle below
If they decide to save, I simply save the payment method to the customers account
You could just include the toggle, update PI to use setup_future_usage and then call fetchUpdates to update the Payment Element based on the changes to the PI.
https://stripe.com/docs/js/elements_object/fetch_updates
Oh I confused myself again, I thought I'd have to update the clientSecret (not sure why I keep thinking that).
Yeah, that'd work pretty good.
Just to confirm, using this checkout flow I will have to listen to the webhook callbacks, correct?
No. This would save the PM to the customer as part of the payment process. It would still be a good idea to listen to webhooks but they are not mandatory
Oh yes, you would want to do that as a best practice
Got it, that answers everything; thank you as always.
Happy to help ๐