#paul-paymentelement-subscription
1 messages ยท Page 1 of 1 (latest)
Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- paul-deferred-intent, 53 minutes ago, 7 messages
paul-paymentelement-subscription
๐ Hey Paul! Sorry this is a bit confusingly worried and it shows you're quite lost overall with our products and set up (which is totally normal)
What are you really trying to do exactly? Do you have an existing Subscription and the Customer wants to enter new card details and then use that new card for the Subscription? Or something else?
Thank you for your understanding & empathy. I currently use a BillingPortal configuration to allow the user to add/edit payment methods for their subscription. I want to change this to allow them to update their payment methods in the app without any redirects to an external page ๐
Hello, stepping in as koopajah has to leave soon. If you are looking to implement your own custom form to save card details for existing users, the PaymentElement does sound like the right fit. In this case you would create a new SetupIntent using the existing Customer's ID.
And once the intent is confirmed you would set the newly created payment method as the customer's default payment method by updating their invoice_settings[default_payment_method] property https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
So it sounds like I will have to create a new SetupIntent each time the client decides to update their payment method. What happens if the client decides midway not to finish updating their payment method? Does the SetupIntent get deleted automatically after sometime? Or should I retrieve the latest created SetupItnent for this user the next time they decide to update their payment method?
Intents don't get automatically deleted, their lifespan is indefinite as long as they don't succeed or manually get deleted
That being said there is also this flow that lets you collect details before creating an intent https://stripe.com/docs/payments/accept-a-payment-deferred?platform=web&type=setup
So that may be better in your situation
Is it a requirement to have a SetupIntent to use the PaymentElement? Is it possible to use it without a SetupIntent?
In that doc that I just sent it shows how to initiate the payment element without an intent
You will need a SetupIntent at some point to save these new PaymentMethods properly, but you don't need one to initially render the payment element
Ah sorry, I meant to ask if I can save the payment method to the subscription without a SetupItntent, but I guess you answered that question as well
Yep, so you will want a SetupIntent to manage things like 3DS
Is it best practice to delete an existing payment method and add a new one as opposed to updating an existing payment method? Asking because this seems to be the only option in the BillingPortal
Yep, that is actually what the customer portal does behind the scenes
Actually it may not do the deleting part, it may just add the payment method. But that is the basic concept
Is there a way to delete a payment method? I don't see a way to delete a SetupIntent or a PaymentMethod
You can detach the PaymentMethod, it is functionally deleting it and the payment method can not longer be used https://stripe.com/docs/api/payment_methods/detach
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I see! Thank you so much for your help ๐
May I ask another question? In the step for submitting the payment method information: https://stripe.com/docs/payments/accept-a-payment-deferred?platform=web&type=setup#submit-the-setup
It creates the SetupIntent & confirms the SetupIntent all from the client side. Is it possible to take the info in the PaymentElement and do all of this on the server side? Assuming not since credit card info is sensitive information but was just wondering if there is a way to do this
Yep, this flow would let you do that https://stripe.com/docs/payments/finalize-payments-on-the-server?platform=web&type=setup
You would tokenize their info into a PaymentMethod object, pass the PM to your server, and confirm a SetupIntent with that PM