#romas9110
1 messages · Page 1 of 1 (latest)
Hi there!
hey
the Payment Element doesn't support this
but if you already have a payment method saved, then you don't need the Payment Element at all
you can directly try to charge the payment method
I want to allow customer to change payment method during checkout. For example for service A he choose credit card VISA, for service B he decides to change to MASTERCARD
yes that's something you can build on your end: list all the customer's payment method, and display them on your website. then depending on what the user chose, create a PaymentIntent for that payment method.
no need for the Payment Element at all.
hm, is there any demo code for this logic?
Ok, let's say I save customer CC during first checkout. And for second checkout I create PI with saved payment method. How to submit payment to stripe with that info from my system?
I guess there should be some button
you create a PaymentIntent with payment_method set and validate:true. then check the status of the PaymentIntent:
- if it's
succeeded, then there's nothing left to do - if it's
requires_action, then you need to call https://stripe.com/docs/js/payment_intents/confirm_card_payment#stripe_confirm_card_payment-attached to trigger 3DS on the frontend
hm... So for customer it would be like simple button with "Submit payment" while at the top I show card which will be used for payment?
Is this doable I guess...
yep. and you call list the customer's payment method with this endpoint: https://stripe.com/docs/api/payment_methods/customer_list?lang=php
daaamn... Thank you!