#Stone.D-Customer
1 messages · Page 1 of 1 (latest)
Hi there, are you referring to invoice_settings.default_payment_method (https://stripe.com/docs/api/customers/object?lang=cli#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.
Customer customer = null;
customer = Customer.retrieve(userVo.getStripeCustomerId());
PaymentMethod defaultPayment = null;
if (customer.getInvoiceSettings() != null && customer.getInvoiceSettings().getDefaultPaymentMethod() != null) {
defaultPayment = PaymentMethod.retrieve(customer.getInvoiceSettings().getDefaultPaymentMethod());
}
tan 你好
这是我的代码,
但是这可能不是正确的,如果:我有两个支付方式,在Dashboard删掉默认的支付方式,使用Api获取不到Default payment
这是我编写的获取默认支付方式的代码
Hi @true falcon Let's continue conversations in English, so that my colleagues can easily follow-up when you need help and I'm not around.
Can you tell me what do you want to achieve here? are you trying to retrieve a payment method for subscription?
ok,
I think the scenario: on the app side, after the user logs in, the payment method is displayed, and the default payment method is displayed on the interface.
No attempt was made to retrieve the payment method for the subscription
The above picture is the implemented interface, showing the list of payment methods and the default payment method
OK. Thanks for the context.
Your code looks OK to me.
Btw since the Dashboard is using Sources API to manage the customer's payment method, the default payment method that you see in Dashboard is customer's default_source (https://stripe.com/docs/api/customers/object?lang=cli#customer_object-default_source)
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
What's the difference between customer.getInvoiceSettings().getDefaultPaymentMethod() And default_source?
Which is the most reliable