#tequila-customer-payment-methods

1 messages · Page 1 of 1 (latest)

icy frost
#

There is no such default for one time payment intents, you always need to explicitly provide a payment method to use

cloud sleet
#

Is there a way to go from the Customer object to its default PaymentMethod?

icy frost
#

sure, you can look at the customer object and inspect invoice_settings.default_payment_method as the docs above refer you.

cloud sleet
#

I'm using this...

#

Customer customer = Customer.retrieve("cust_1234");
PaymentMethod paymentMethod = customer.getInvoiceSettings().getDefaultPaymentMethodObject();

#

but getting null

daring latch
#

Hello! What's the Customer ID?

cloud sleet
#

cus_Kb97j74Vt0E341 its a test user

daring latch
#

Thanks, let me take a look...

#

Hm, there is a default Payment Method set for Invoices on that Customer...

#

Does PaymentMethod paymentMethod = customer.getInvoiceSettings().getDefaultPaymentMethod(); work?

cloud sleet
#

yep that return the id so was able to use it to call the PaymentMethod API and got back the full object. Thanks.