#k3x_
1 messages ยท Page 1 of 1 (latest)
๐ happy to help, please give me a moment to read through your message
If I'm understanding your question correctly, what you're looking for is this parameter https://stripe.com/docs/api/customers/object#customer_object-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.
which makes an attached payment method on a customer object be the default one used for any subscription for this customer
Well yes but I don't know how to get the customer's payment method
you're migrating from one account to another?
Yes
there are a couple of ways to handle that
either you need to contact https://support.stripe.com/?contact=true and ask for help migrating your customers/payment methods
Find help and support for Stripe. Our support site provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
I already did copy my customers and their payment methods are associated with them
here is an example
what do you mean by that then?
Their payment methods are here but not default
So I have to make a loop for all my customers
Through the api, how to get each payment method
oh fair point
now I understand what you need
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
So I get an array
I get the first method
Assign it as default
and therefore for all customers
But how about the new customers, how to set as default automatically
you need to listen to the payment_method.attached event https://stripe.com/docs/api/events/types#event_types-payment_method.attached and if the customer doesn't have a default method then you would assign it using the invoice_settings.d_p_m parameter I sent you earlier
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
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.
Ok thank you very much