#Naqet-Customer
1 messages · Page 1 of 1 (latest)
You would want to make the new card as invoice_settings.default_payment_method then it will be used for future payment: https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
But in the docs in source info there is this information. I have token with card details etc. and I would want exactly the same behaviour as the one listed here.
When creating new card token I do not have ID of payment method. I would need to fetch it after adding new source, and delete it manually.
I just want to replace old card with new one if that makes sense. And this source info does exactly that
Does it not work or do I make something wrong?
Because new card is added, but is not replacing the old one. This is main problem right now.
Hmm looks like it should replace the old one then. Could you provide the request Id that didn't work for you?
req_wZNvtUngZqtjQD
Hi, I think for this customer cus_KAcXdU1cE5qLHR, it has the source tok_1JglSyHtsP0GbMaLGiAyiQY9 you set as default source
The second card was added via token, and it is not set as default
Did you add the 4199 one before or after the request req_wZNvtUngZqtjQD?
Is has been added with stripe.customers.update function.
I just added source attribute to the request and it was added. If I understand correctly, it should have replaced it with the default card, but it did not
Hi, I can't know which object related to that 4199 card. Could you provide the request id that you attach that card?
tok_1JglSyHtsP0GbMaLGiAyiQY9 this token had all information about the card
req_wZNvtUngZqtjQD this request was made with stripe.customers.update
and it added new payment method
But for some reason it did not replace the old one
req_ohijrJ68hV864o this request created the token that I used after
Sorry for late response. Yes I can see the 4199 should be the default, and from our end I can confirm it's the default as well
What UI is this?
the 1052 is an older Card, correct?
yes, 1052 is older card.
Hi, sorry I have to run for today. Let me ask @humble glen for help you in further
so note that updating the customer and passing source only replaces other sources/cards/legacy objects
if the customer has an invoice_settings[default_payment_method] and PaymentMethods pm_xxx (as that one does), those are completely unaffected
just ignore Sources/Cards/Tokens, they're legacy! were you using them before today or did you just start using them because you saw in the docs that customer.update(source=xxx) replaces cards and it's what you wanted?
the correct way to do this in the current version of the API is to call https://stripe.com/docs/api/payment_methods/detach to detach any existing PaymentMethods and add the new ones using SetupIntents/PaymentIntents
if you're not actually working on a legacy integration that already has customers with card_xxx s, just ignore that part of the API(and the source and default_source fields on the Customer object), it's legacy and irrelevant to you!