There is a way to get a list of all cards:
gateway.creditCard.expiringBetween(year1900, year2100, function (err, result) {...})
and then call paymentMethod.find
for each individual card. But I would like to get all payment methods associated with a customer, in one call, is this possible?
I work at Braintree. If you have more questions, you can always get in touch with our support team.
A customer is serialized with all of its payment methods.
So, get the customer and then get the credit cards and paypal accounts from it:
gateway.customer.find("theCustomerId", function(err, customer) {
var payment_methods = customer.creditCards.concat(customer.paypalAccounts);
});
I figured that. gateway.customer.find
returns an object with property creditCards
, just wasn't obvious from the documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With