#ironbeard-subscription

1 messages ยท Page 1 of 1 (latest)

viscid rapids
#

Hi there!

untold sable
#

heyo!

viscid rapids
#

What is your question exactly?

untold sable
#

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.

viscid rapids
#

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.

untold sable
#

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

untold sable
#

Just bumping in case this got overlooked, but no rush

viscid rapids
#

Sorry for the delay, Discord got busy. Will have a look shortly.

untold sable
#

no worries

lavish creek
#

@untold sable You need a way to clear the CardElement, is that right?

#

Should do it

untold sable
#

๐Ÿ™Œ thanks ๐Ÿ™‚

#

Sorry to bother you guys on a holiday, didn't realize it until just now. Have a great day!

lavish creek
#

It's only a US holiday, and I'm not based there ๐Ÿ™‚

untold sable
#

Oh, fair enough ๐Ÿ™‚

lavish creek
#

Closing this out now, hope you're unblocked!