Searching for Credit Cards

Single Credit Card

If you want to look up a single credit card using its token, use the find method.

$creditCard = Braintree_CreditCard::find('token');

To determine if credit_card is a Customer’s default Credit Card:

$creditCard->isDefault();

If the credit card cannot be found, it will throw a Braintree_Exception_NotFound exception.

Transactions

You can find transactions associated to a specific credit card token using the transaction search API.

$collection = Braintree_Transaction::search(array(
    Braintree_TransactionSearch::paymentMethodToken()->is('the_token')
));

Expired Cards

You can find all credit cards stored in the vault that are expired.

$collection = Braintree_CreditCard::expired();

You can also search for credit cards that expire between a date range.

$collection = Braintree_CreditCard::expiringBetween(
    mktime(0, 0, 0, 1, 1, 2009),
    mktime(23, 59, 59, 12, 31, 2009)
);