#cnguyen-card-multiple-payments
1 messages · Page 1 of 1 (latest)
Why do you save the card if you don't re-use it anyway?
but yes, keeping the most recent successful one seems correct as long as they know future payments will use that one
And to update the default one. I use await stripe.customers.update(
stripeCustomerId,
{ invoice_settings: { default_payment_method: eventObject.payment_method } }
)
I suppose that it's the good way
And I want to detach the old one to avoid to have a list like that
But I try to call detach, but I don't see where I specify the customer ? Like that await stripe.paymentMethods.detach(pm.id, {customer: stripeCustomerId}); ? Or I don't need because the pm_XXX is unique
pm_123 is unique so you just pass the id
I use it later for a subscription. But the user can use his card again. And it's this case that I try to manage. Because the user has already one PI with a specific card and a subscription (or not) on this card.
But he can purchase again with the same card. So I have a new pm_XXX. And my solution is to take the last one as the default one. Detach the old one if it's the same fingerprint. And I suppose that if I change the default_payment_method in the invoice_settings, it update the card for the subscription too.
then what you do is fine yes
OK. And it's the best way to detach ? Or maybe I have to delete it ?
Detach is the right way, there's no "delete", detach is the delete
yes!
thank you 🙏