#Dooing - card

1 messages · Page 1 of 1 (latest)

shy harbor
#

Hi there!

#

What do you mean by "primary card"? The default card?

spice shard
#

the card that is used for payments, by default

#

so far I know it as the "primary card"

#

in stripe speak

#

I assume this info is not on the card, but the customer?

#

I assume, further,
I have to retrieve the customer and add:
.build()).addExpand("invoice_settings.default_payment_method")

#

?

#

Amd then...
stripeCustomer.getDefaultSourceObject()
?

shy harbor
#

Yes invoice_settings.default_payment_method is the default payment method of the customer

spice shard
#

???

#

ok let me ask again

#

How can I retrieve the default payment method of a customer

#

Can I get this directly form the payment method - is default true / false?

#

OR - as I assume - do I have to retrieve the customer?

shy harbor
#

How can I retrieve the default payment method of a customer
You use invoice_settings.default_payment_method
Can I get this directly form the payment method - is default true / false?
Not possible
OR - as I assume - do I have to retrieve the customer?
Correct

spice shard
#

... And, further... onthe assumption that I have to retrieve the customer... it has a payment object..
Does this contain the id? I guess since I retrieve all cards anyway... this might be enough for identitifcation.. or, alternatively, do I have to add an extend, e.g to get the fingerprint

#

--=
What I want to do - retrieve all payment methods of a given customer, like so:
PaymentMethod.list(

then map those cards to my business objects.. and flag the card that is default as default

#

so I assume, it's two calls - list cards - then retrieve customer, get default card, if and then match this to the id of the list call

#

or is there a way to combine both, e.g. with an expand in some way?

shy harbor
#

so I assume, it's two calls - list cards - then retrieve customer, get default card, if and then match this to the id of the list call
Yes, you can use this https://stripe.com/docs/api/payment_methods/list to list all payment method for a specific customer. And use invoice_settings.default_payment_method on the customer itself to know which one is the default.

spice shard
#

use invoice_settings... as an extend. you mean?

#

wouldnt just - stripeCustomer.getDefaultSource()
be sufficient to retrieve the id of the card?