Reputation: 2660
How to enable users to update their subscription's payment method using Stripe Elements? I couldn't find any reference to this neither in the docs nor on Stackoverflow.
This is how I'm currently setting the default payment method when the user first subscribes to our service.
stripe.confirmCardPayment(cardElement)
invoice.payment_succeeded
webhook event.Is there a way to update the subscription's payment method without making a payment_intent first? Link to docs would be appreciated.
Thank you
Upvotes: 2
Views: 2535
Reputation: 2784
You can use SetupIntents to save a customer’s card without an initial payment : https://stripe.com/docs/payments/save-and-reuse-cards-only [until step 4]
Listen for the setup_intent.succeeded
webhook event to know when the SetupIntent is successful since the customer could close the browser window or quit the app before the stripe.confirmPayment callback executes.
Update the Subscription to use the resulting PaymentMethod ID as the default payment method.
Alternatively, you could also make use of the Customer Portal to allow customers to update their payment method for a subscription : https://stripe.com/docs/billing/subscriptions/customer-portal
Upvotes: 2