#rob_customer-defaultpm
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1245883869278769152
๐ Have more to share? Add details, code, screenshots, videos, etc. below.
@unique token You can only do this on the server using your Secret API key and calling the Update Customer API https://docs.stripe.com/api/customers/update
Is there an example of updating the PaymentMethod on the server via the Update Customer API available?
Ok so looking at that snippet that is what I am doing after the first invoice.payment_succeeded with billing_reason = subscription_create. So I guess what I am asking is there a way to create a new PaymentMethod via the PaymentElement and then associate it with the Customer? And then on the server -- maybe listening to the payment_method.attached webhook -- then use API to set the default payment method like in the snippet example you just provided?
https://docs.stripe.com/payments/save-and-reuse?platform=web&ui=elements
You use SetupIntents to collect a brand new card and then once it succeeds you can update the Customer to make that new card the default
Ah perfect! I see, so when I am calling the PaymentElement JS framework using the Subscirption's PaymentIntent clientSecret in the JS it sets up a SetupIntent in the background for the recurring charges. So I just need to create a new SetupIntent and use that objects client's secret for the PaymentElement? Also I want to set the usage to off_session correct? Any other settings needed?
๐ Taking over this thread, catching up now
Yup! You will create a Setup Intent with usage as off_session to collect new payment method, then set the newly collected payment method as default to the subscription
Awesome thanks @empty spear @spark crystal I will give this a go and reach back out if I run into any issues! You guys rock!