#freshcarthq
1 messages · Page 1 of 1 (latest)
Payment Method doesn't have a default field. Default payment method of a customer can be found in the invoice_settings.default_payment_method field of Customer object: https://docs.stripe.com/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.
In my use case, I am saving the stripe customer and the associated payment method ids (IDs only) in my app db, just so to avoid redundant calls to the Stripe API. However, if a customer has multiple payment methods attached to it. I need to indicate the default one on my app so that my app can use that payment method to initiate the checkout flow.
My user object looks like this
{ "userId": "743e589d-39bd-4f40-aa54-a1c5a19ba50b", "payment_methods": [ { "stripeCustomerId": "cus_.....", "default": true, "billing_details": {...} }, { "stripeCustomerId": "cus_.....", "default": true, "billing_details": {...} } ] }
Thanks for sharing the details. As mentioned earlier, default payment method can only be found in Customer object, but not on Payment Method object itself
Okay, so I will need to set the default flag in the customer object and then associate it my internal user ID?
Yes, that is right!
Just to be clear we are talking about the same thing....This default flag in the dashboard is the same one in the customer object?
Yes! This is the same one in the customer object. I'd recommend giving a try in test mode
Thanks. I will try it out.