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 creditCard = gateway.creditCard().find("the_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 NotFoundException.
Transactions
You can find transactions associated to a specific credit card token using the transaction search API.
TransactionSearchRequest searchRequest = new TransactionSearchRequest().
paymentMethodToken().is("the_token");
ResourceCollection<Transaction> collection = gateway.transaction().search(searchRequest);
Expired Cards
You can find all credit cards stored in the vault that are expired.
ResourceCollection<CreditCard> expiredCards = gateway.creditCard().expired();
You can also search for credit cards that expire between a date range.
Calendar start = Calendar.getInstance();
start.set(2010, 0, 1);
Calendar end = Calendar.getInstance();
end.set(2010, 11, 30);
ResourceCollection<CreditCard> expiredCards = gateway.creditCard().expiringBetween(start, end);