#Gesundheit-setupintents

1 messages · Page 1 of 1 (latest)

solar flame
#

Hello! What's your question?

late nimbus
#

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?

solar flame
#

You can't update a Payment Method - you'd have to detach their existing one, and then create the new one

late nimbus
#

Gotcha. That makes a lot of sense

#

But then what is update used for?

solar flame
#

You can update specific fields on the Payment Method like it's metadata or the billing address

late nimbus
#

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?

solar flame
#

Yup!

late nimbus
#

very cool.

#

Thanks a lot for the help!

#

should i listen to payment_method.attached or setup_intent.succeeded?

solar flame
#

I'd listen for setup_intent.succeeded, but I believe either would work

late nimbus
#

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

quasi folio
#

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 a card_123 , it can be used "as a PaymentMethod"

late nimbus
#

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?)

quasi folio
#

yes Dashboard sets sources: for legacy reasons but cards under sources: can be listed as PaymentMethods using the PaymentMethods list endpoint

#

cause of backward compatibility

late nimbus
#

good to know!

#

thanks a lot for the help