#Wik
1 messages · Page 1 of 1 (latest)
Hi there, is your customer's credit card info saved as source or payment_method?
payment_method
OK. Although a customer has a default_source , there' s no default_payment_method property in a customer object.
Therefore, when you want to create a charge with payment_intents API on a customer, you also need to specify the payment_method ID.
Let me find an example
I have a test user https://dashboard.stripe.com/test/customers/cus_My2DVswBz7tdtr. They have two cards. The default one ends in 4242. I want to make the card ending in 0001 default via API. Is it possible? I can easily do it via the dashboard but I need to do it for ~500 customers, so I'd rather write a script for that
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
I see. yes you can do it programmatically. All you need to do is
- unset the
default_source - set the 0001 card to either
default_sourceorinvoice_settings.default_payment_method
How do I unset and set the default source via API?
just default_source=null
Ok, cool, thank you!