#DramaLlama-PaymentMethod-Card

1 messages · Page 1 of 1 (latest)

mental mesa
#

What are you trying to do with the PaymentMethod? If you have the PaymentMethod object it typically makes more sense to use the PaymentMethod than the underlying Card

iron panther
#

So I have a saas where we bill monthly after usage. So first invoice is after a month.

We allow the customer to input card at any point before the first invoice.

We used to use cards but I am making it sca compliant now, thus payment method

mental mesa
#

So yes, use the PaymentMethod

iron panther
#

What happens with paymentMethods not attached to any customer?

mental mesa
#

Also apologies, I was confused. In this case there will not be a Card at all. The PaymentMethod is what you will use

iron panther
#

But there is still a PaymentMethod.Card but I guess it's not the same thing fully

mental mesa
#

I think you need a Customer for a Subscription

iron panther
#

So I create my custeomers and subscriptions before them entering their card (and thus me creating payment method).

So I use PaymentMethod/attach which seems to work fine.

But we have a simplified logic where we only allow one card for each customer. So I am thinking of detaching all existing payment methods before creating a new (when they update their card).

So just curious to what happens to the old PaymentMethods that are no longer attached to any customer

mental mesa
#

In what way are you still interested in them?

iron panther
#

Just don't want them to trash around around interface anywhere... I alreadu hate that there is no way to delete invoice drafts and they just lay around and are visible in the dashboard

mental mesa
#

Ah so you are wondering if they will still be listed on the Customer?

iron panther
#

Exactly, or somehow listed anywhere where they will bother me

#

as I will consider them past and deleted and I will no longer store a reference myself

mental mesa
#

Are you still seeing PaymentMethods that you detached or are you just basing this off of what you have seen with Invoices?

iron panther
#

It's purely preemptive question.

If I were to do it this way, would they linger

#

I have not done my implementation yet

mental mesa
#

It will be removed from the UI

iron panther
#

Fantastic!

#

But I have one more question about how to do this.

My plan was like this

  1. Customer signs up for our saas, lets say 1st of June. I then create a stripe customer and a subscription.
  2. One month later 1st of July this customer has his first payment coming up.
  3. On the 25th of June after a reminder he goes into his settings page in our platform and enters a card.

Now on the day when the customer browses to our settings, he fills in a card in a stripe elements card form, I then call CreatePaymentMethod and then does attach on this PaymentMethod to the customer. This part seems to work great.

So now I have a PaymentMethodId and said PaymentMethod is attached to the customer (great)

I now want to call confirmCardSetup that will take care of SCA verification if needed. But I see it needs a SETUP_INTENT_CLIENT_SECRET and I don't know where to get that in my scenario

vapid pagoda
#

I can answer, one sec

iron panther
#

Awesome!

#

Maybe I myself found the method

  1. Create my PaymentMethod like before

  2. Create SetupIntent and set customer to my existing customer. and also set payment_method to my paymentMethod from step 1.

  3. use confirmCardSetup as I now have both setup intent and payment method.

#

A question. If a customer has a valid payment method. Will it automatically be used by any monthly subscription or do I have to attach it manually?

vapid pagoda
#

so what you do is, instead of calling createPaymentMethod()

#

you collect a card "via" a SetupIntent

#

so for

  1. On the 25th of June after a reminder he goes into his settings page in our platform and enters a card.
    you want to create a SetupIntent, confirm it with Elements with confirmCardPayment(), that creates a PaymentMethod for you in one go
#

if you create a Customer, then a SetupIntent and pass customer: cus_123 on it, then when you do the rest steps above, that also auto-attaches the PaymentMethod to the Customer

iron panther
#

ah cool, thanks!

#

And about PaymentMethod on a customer, will it be used by subscriptions even if not assigned?

vapid pagoda
#

so you'd have to update that new PM as the default_payment_method on the Subscription

#

for it to be used

iron panther
#

ah alright, then I think I have all my answers!

#

Awesome!

#

Have a fantastic weekend!