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:
- Android Pay Card
- Apple Pay Card
- Credit Card
- PayPal Account
- Samsung Pay Card
- US Bank Account
- Venmo Account
- Visa Checkout Card
Payment method objects included in other responses (such as Customer
) may be any of these types. For example:
Python
customer = gateway.customer.find("the_customer_id")
customer.payment_methods # array of braintree.PaymentMethod instances
Returned directly or within a successful result object from the following requests:
- Payment Method: Create
- Payment Method: Find
- Payment Method: Grant
- Payment Method: Revoke
- Payment Method: Update
Attributes
Examples
Default
To determine if a payment method is the default for its customer:
Python
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.
Python
payment_method = gateway.payment_method.find("credit-card-token")
payment_method.__class__
# <class 'braintree.credit_card.CreditCard'>
payment_method = gateway.payment_method.find("paypal-account-token")
payment_method.__class__
# <class 'braintree.paypal_account.PayPalAccount'>
payment_method = gateway.payment_method.find("apple-pay-token")
payment_method.__class__
# <class 'braintree.apple_pay_card.ApplePayCard'>
payment_method = gateway.payment_method.find("android-pay-token")
payment_method.__class__
# <class 'braintree.android_pay_card.AndroidPayCard'>