#sh3ft

1 messages ยท Page 1 of 1 (latest)

fickle estuaryBOT
astral grove
nova field
#

I'm using Elements from stripe/react-stripe-js

#

What elements do I have to show the user to add their new card?

astral grove
#

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?

nova field
#

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?

astral grove
#

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

nova field
#

What if I want to do that on my site without redirecting the user?

astral grove
#

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

nova field
#

On step 2 what do I need to update default payment method with?

astral grove
#

the new payment method ID (pm_xxx)

The one that was newly created using the SetupIntent in Step 1

nova field
#

By doing that we are not charging users anything right?

astral grove
#

yup

#

it only saves the PaymentMethod

#

they might see $1/$0 auth charge

#

but that would get reversed

nova field
#

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?

astral grove
#

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

nova field
#

I meant the last 4 digits of the card will change to the new card last 4 digits on the card details

astral grove
#

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

nova field
#

Okay cool, will that affect the next payment date?

astral grove
#

It shouldn't affect the billing cycle, no

nova field
#

Okay thank you, for your quick and helpful responses ๐Ÿ˜