#ironbeard-subscription
1 messages ยท Page 1 of 1 (latest)
heyo!
What is your question exactly?
So we're using CardElements with Subscriptions, and creating a Subscription on the backend and then fetching latest_invoice.payment_intent and forwarding the client secret to the CardElement front end
If the user is an existing customer, I wanted to have the option to use default payment method. So my initial idea was just to toggle/hide the CardElement and display some details of their default PM (with a link underneath to "use a new card" which would reveal the CardElement).
My issue is that I'm just hiding the CardElement, but I really need to clear it and then hide it. So I wasnt sure if there was a javascript method for clearing the CardElement.
And then, I was curious as to if this is a decent way to do this, or if there's some way* to hook up the default PM to the CardElement.
My issue is that I'm just hiding the CardElement, but I really need to clear it and then hide it. So I wasnt sure if there was a javascript method for clearing the CardElement.
I'm not sure I understand. Can you clarify what the flow would look like?
And then, I was curious as to if this is a decent way to do this, or if there's some way* to hook up the default PM to the CardElement.
There's no pre-built way to display or select a default Payment Method. That's something that you need to build on your end.
Gotcha on the second part
So this is what my final checkout looks like
if the click the link below the CardElement it hides the CardElement:
But the "problem" is that I've only hidden the card element, and I need to clear it as well, so that when Place Order is pressed, there is no (new) card details sent, since I'm using save_default_payment_method: 'on_subscription' in my Subscription creation call
Just bumping in case this got overlooked, but no rush
Sorry for the delay, Discord got busy. Will have a look shortly.
no worries
@untold sable You need a way to clear the CardElement, is that right?
Should do it
๐ thanks ๐
Sorry to bother you guys on a holiday, didn't realize it until just now. Have a great day!
It's only a US holiday, and I'm not based there ๐
Oh, fair enough ๐
Closing this out now, hope you're unblocked!