There are multiple types of payment methods. For the attributes of a specific type of payment method response, see one of the following response objects:

Payment method objects included in other responses (such as Braintree_Customer) may be any of these types. For example:

PHP
Click to copy
Copied
$customer = Braintree_Customer::find('a_customer_id');
$customer->paymentMethods // array of Braintree_PaymentMethod instances

Returned directly or within a successful result object from the following requests:

Attributes
token string

An alphanumeric value that references a specific payment method stored in your Vault.

Examples

Default

To determine if a payment method is the default for its customer:

PHP
Click to copy
Copied
$paymentMethod->isDefault();

Determine payment method type

To determine the type of payment method (e.g. credit card, PayPal), you need to inspect the class of the payment method object.

PHP
Click to copy
Copied
$paymentMethod = Braintree_PaymentMethod::find('credit-card-token');
get_class($paymentMethod)
# Braintree_CreditCard

$paymentMethod = Braintree_PaymentMethod::find('paypal-account-token');
get_class($paymentMethod)
# Braintree_PayPalAccount

$paymentMethod = Braintree_PaymentMethod::find('apple-pay-token');
get_class($paymentMethod)
# Braintree_ApplePayCard

$paymentMethod = Braintree_PaymentMethod::find('android-pay-token');
get_class($paymentMethod)
# Braintree_AndroidPayCard

Still have questions?

If you can’t find an answer, contact our Support team.