NAME
WebService::Braintree::CreditCard
PURPOSE
This class creates, updates, deletes, and finds credit cards.
CLASS METHODS
create()
This takes a hashref of parameters and returns the credit card created.
from_nonce()
This takes a nonce and returns the credit card (if it exists).
find()
This takes a token and returns the credit card (if it exists).
update()
This takes a token and a hashref of parameters. It will update the corresponding credit card (if found) and returns the updated credit card.
delete()
This takes a token. It will delete the corresponding credit card (if found).
credit()
This takes a token and an optional hashref of parameters and creates a credit transaction on the provided token.
sale()
This takes a token and an optional hashref of parameters and creates a sale transaction on the provided token.
expired_cards()
This returns a list of all the expired credit cards.
NOTE: This method is called expired()
in the Ruby and Python SDKs. It is renamed in this SDK because it clashes with the object attribute expired
.
expiring_between()
This takes two DateTime objects and returns a list of all the credit cards expiring between them.
OBJECT METHODS
In addition to the methods provided by the keys returned from Braintree, this class provides the following methods:
billing_address()
This returns the credit card's billing address (if it exists). This will be an object of type "" in WebService::Braintree::Address.
masked_number()
This returns a masked credit card number suitable for display.
expiration_date()
This returns the credit card's expiration in MM/YY format.
is_default()
This returns true if this credit card is the default credit card.
is_venmo_sdk()
This returns true if this credit card uses the Venmo SDK.
NOTES
Most of the classes normally used in WebService::Braintree inherit from "" in WebService::Braintree::ResultObject. This class, however, inherits from "" in WebService::Braintree::PaymentMethod. The primary benefit of this is that these objects have a token()
attribute.