Payment Method
- Apple Pay Card
- Credit Card
- Google Pay Card
- PayPal Account
- US Bank Account
- Venmo Account
- Visa Checkout Card
Customer
) may be any of these types.
For example:
- PHP
$customer = $gateway->customer()->find('a_customer_id');
$customer->paymentMethods; // array of Braintree\PaymentMethod instances
Server-side response object returned directly or within a successful result object from the following requests:
Attributes
token
stringAn 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
$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
$paymentMethod = $gateway->paymentMethod()->find('credit-card-token');
get_class($paymentMethod)
# BraintreeCreditCard
$paymentMethod = $gateway->paymentMethod()->find('paypal-account-token');
get_class($paymentMethod)
# BraintreePayPalAccount
$paymentMethod = $gateway->paymentMethod()->find('apple-pay-token');
get_class($paymentMethod)
# BraintreeApplePayCard
$paymentMethod = $gateway->paymentMethod()->find('google-pay-token');
get_class($paymentMethod)
# BraintreeGooglePayCard