#bilalahmer
1 messages ยท Page 1 of 1 (latest)
Hi there!
What do you mean by "update credit card"? You have an existing payment method that you want to edit? What do you want to edit?
Yes, I want to change my cc .
The above flow is done by old api.
I just want to switch to setupIntent.
So my question is how can I change my cc card using setupIntent api ?
like in the snap i have maser card but now i want to use visa card so how can I do that with setupIntent ?
Do I have to integrate paymentElement first ?
SetupIntent is to create a new payment method, not to update an existing payment method.
But if you want to learn how to use the SetupIntent + Payment Element, then you shoulr read this guide: https://stripe.com/docs/payments/save-and-reuse?platform=checkout
Stripe::Customer.update(@id, { default_source: source }) like this code is being used to update .
So for setupIntent do I need to use someother api or the same one ?
I still don't understand your question. Do you want to:
- Create a brand new Payment Method for a customer?
- Or update some information about an existing Payment Method?
Update some information about an existing Payment method.
What information do you want to update exactly?
credit card number.
That's not possible, so actually you want to create a brand new Payment Method for a customer.
Oh, ok
So you should read this guide for Checkout Session: https://stripe.com/docs/payments/save-and-reuse?platform=checkout
Or this guide for SetupIntent: https://stripe.com/docs/payments/save-and-reuse?platform=web&ui=elements
Ok , Thankyou will have a look.
Happy to help ๐
Just one more question
So we cant update credit card number, for that we have to create new payment method through setupIntent right ?
Correct
So if i create new payment method through setupIntent, will the Stripe::Charge.create api will work ?
I will change it with the PaymentIntent in the next step but just for time being can I use Stripe::Charge.create with setupIntent ?
nope! the SetupIntent creates a PaymentMethod, and PaymentMethods can not be used in the Charge API.
Yes, but it is already being used.
My next step is to move to paymentIntent .
I don't want to change to much code at one time.
Got it, Thankyou.
Than how do you recommend I approach it.
Like I want to migrate to setupIntent and paymentIntent ?
Like I was thinking to change it to first setupIntent and than later move to paymentIntent .
But know I think I have to change both at the same time in all places right ?
best option is to change to PaymentIntent first really
since a PaymentIntent can charge legacy objects like. Card card_xxxx or Source src_xxx so it just works