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 Customer) may be any of these types. For example:

Ruby
Copy
Copied
customer = gateway.customer.find("a_customer_id")
customer.payment_methods # array of PaymentMethod instances
This code snippet now uses gateway instance methods instead of class-level methods. Learn more.

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:

Ruby
Copy
Copied
payment_method.default?

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.

Ruby
Copy
Copied
payment_method = gateway.payment_method.find("credit-card-token")
payment_method.class
#=> Braintree::CreditCard

payment_method = gateway.payment_method.find("paypal-account-token")
payment_method.class
#=> Braintree::PayPalAccount

payment_method = gateway.payment_method.find("apple-pay-token")
payment_method.class
#=> Braintree::ApplePayCard

payment_method = gateway.payment_method.find("android-pay-token")
payment_method.class
#=> Braintree::AndroidPayCard
This code snippet now uses gateway instance methods instead of class-level methods. Learn more.

Still have questions?

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