#sh3ft
1 messages ยท Page 1 of 1 (latest)
Hello ๐
Are you trying to build your own UI for this?
You can just use the customer portal instead and allow customers to self-serve this
https://stripe.com/docs/customer-management
https://stripe.com/docs/customer-management/integrate-customer-portal
I'm using Elements from stripe/react-stripe-js
What elements do I have to show the user to add their new card?
You didn't answer my question above ๐
Are you trying to build your own UI for this?
Also, did you look at the link I shared for customer portal? Does that not fit your usecase?
Yes sorry, I'm trying to build my own UI for it, also I think the second link maybe will do the job for me, but I'm not sure, can I change register card of the user if I follow the second link?
can I change register card of the user if I follow the second link?
You can redirect your customers/users to the customer portal page and they can update the payment method themselves
What if I want to do that on my site without redirecting the user?
It would be multiple steps.
1/ Collect and attach a new PaymentMethod to customer using SetupIntents API
https://stripe.com/docs/payments/save-and-reuse?platform=web&ui=elements
2/ Then you can update the subscription default payment method by calling the API
https://stripe.com/docs/api/subscriptions/update#update_subscription-default_payment_method
3/ If you want to make the new payment method, default payment method on the customer then you'd need to separately call the customer update API
https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method
On step 2 what do I need to update default payment method with?
the new payment method ID (pm_xxx)
The one that was newly created using the SetupIntent in Step 1
By doing that we are not charging users anything right?
yup
it only saves the PaymentMethod
they might see $1/$0 auth charge
but that would get reversed
Okay, last question once I finish all 3 steps will the last_4 change to be the same with the new card last 4 digits or are there any additional steps I need to take?
Not sure I follow the question, last_4 where exactly?
You're replacing the payment method object as whole. You're not really updating an existing payment method object
I meant the last 4 digits of the card will change to the new card last 4 digits on the card details
Again, you can't update an existing card_xxx, pm_xxx etc objects with new card details.
For example, let's say
1/ sub_one is using pm_one that has last four as 1234
2/ You collect a new payment method that generates pm_two that has last four as 4567
3/ Then you update sub_one to use pm_two instead
So you're not really updating pm_one here so last 4 update doesn't really make sense
Okay cool, will that affect the next payment date?
It shouldn't affect the billing cycle, no
Okay thank you, for your quick and helpful responses ๐