#Quentin
1 messages · Page 1 of 1 (latest)
Hi there!
hi
I'm not sure I understand your question. Can you clarify?
I've made a subscription
with a credit card respecting the sca2 validation
it's okay for you?
What do you mean "it's okay for you"? What's your exact question?
I just asking if it's clear for you before I continue my explaination
I continue so
the subscription still working month after month
but the customer sees that is payment card is expiring, so he wants to add a new one to the subscription to avoid service cancelation
how do we change the card (paiement method)? Do we have to respect a new sca2 validation?
So you want to change the payment method used for an active subscription? Do you want to do that before or after that an invoice is created and failed?
before that an invoice is created
Got it. So you would need to create a SetupIntent to attach a new PaymentMethod to the customer, and then set it as the default payment method for that customer.
so
const setupIntent = await stripe.setupIntents.create({
payment_method_types: ['card'],
});
I get a client secret
I use stripeElement to validate the card with this client secret
now the customer has the new PM so i change the default paimentMethod on the subscription
that's it?
Yes, exactly! For the last step, you can either update the default payment method of the customer (https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method) or the default payment method of the subscription (https://stripe.com/docs/api/subscriptions/update#update_subscription-default_payment_method)