#Gesundheit-setupintents
1 messages · Page 1 of 1 (latest)
HI!
I'm collecting cards for future payments. In the case where the user already has a card, and they simply want to replace it with a new one
do i use Update? or Create?
You can't update a Payment Method - you'd have to detach their existing one, and then create the new one
You can update specific fields on the Payment Method like it's metadata or the billing address
I see. Well, in our scenario where we only need the card, i don't think it hurts to just wipe it clean and create a new payment method instead.
But in the case where we only want one card on every user, I should use webhooks to follow up on detaching the old card and marking the new one default?
Yup!
very cool.
Thanks a lot for the help!
should i listen to payment_method.attached or setup_intent.succeeded?
I'd listen for setup_intent.succeeded, but I believe either would work
any particular reason?
Also, in the api reference page the returned payment_method property started with card_ instead of pm_. Will that matter?
see attached image
looking
Also, in the api reference page the returned payment_method property started with card_ instead of pm_. Will that matter?
the PaymentMethod API is backward compatible with the older Cards API
so anywhere you see acard_123, it can be used "as a PaymentMethod"
gotcha. Yeah I ran into a problem some time earlier where the dashboard will register a new payment method under a customer's source instead of payment_method, so i just wanted to be extra careful about that.
(turns out it was only the dashboard that was doing so... a little bit surprised?)