You are here

public static function Braintree_CreditCard::find in Commerce Braintree 7

find a creditcard by token

@access public

Parameters

string $token credit card unique id:

Return value

object Braintree_CreditCard

Throws

Braintree_Exception_NotFound

12 calls to Braintree_CreditCard::find()
Braintree_CreditCardTest::testCreate_withDefault in braintree_php/tests/integration/CreditCardTest.php
Braintree_CreditCardTest::testDelete_deletesThePaymentMethod in braintree_php/tests/integration/CreditCardTest.php
Braintree_CreditCardTest::testErrorsOnFindWithBlankArgument in braintree_php/tests/unit/CreditCardTest.php
Braintree_CreditCardTest::testErrorsOnFindWithWhitespaceArgument in braintree_php/tests/unit/CreditCardTest.php
Braintree_CreditCardTest::testErrorsOnFindWithWhitespaceCharacterArgument in braintree_php/tests/unit/CreditCardTest.php

... See full list

File

braintree_php/lib/Braintree/CreditCard.php, line 195

Class

Braintree_CreditCard
Creates and manages Braintree CreditCards

Code

public static function find($token) {
  self::_validateId($token);
  try {
    $response = Braintree_Http::get('/payment_methods/' . $token);
    return self::factory($response['creditCard']);
  } catch (Braintree_Exception_NotFound $e) {
    throw new Braintree_Exception_NotFound('credit card with token ' . $token . ' not found');
  }
}