Class: Braintree::Customer


More Information

For more detailed documentation on Customers, see www.braintreepaymentsolutions.com/gateway/customer-api


Attributes
[R] addresses
[R] company
[R] created_at
[R] credit_cards
[R] custom_fields
[R] email
[R] fax
[R] first_name
[R] id
[R] last_name
[R] phone
[R] updated_at
[R] website

Public Class Methods
_fetch_customers(ids)
_fetch_transactions(customer_id, ids)
all()

Returns a ResourceCollection of all customers stored in the vault.

  customers = Braintree::Customer.all
  customers.each do |customer|
    puts "Customer #{customer.id} email is #{customer.email}"
  end
create(attributes = {})

Creates a customer using the given attributes. If :id is not passed, the gateway will generate it.

  result = Braintree::Customer.create(
    :first_name => "John",
    :last_name => "Smith",
    :company => "Smith Co.",
    :email => "john@smith.com",
    :website => "www.smithco.com",
    :fax => "419-555-1234",
    :phone => "614-555-1234"
  )
  if result.success?
    puts "Created customer #{result.customer.id}
  else
    puts "Could not create customer, see result.errors"
  end
create!(attributes = {})
create_customer_url()
create_from_transparent_redirect(query_string)
credit(customer_id, transaction_attributes)
credit!(customer_id, transaction_attributes)
delete(customer_id)
find(customer_id)
sale(customer_id, transaction_attributes)
sale!(customer_id, transaction_attributes)
transactions(customer_id, options = {})

Returns a ResourceCollection of transactions for the customer with the given customer_id.

update(customer_id, attributes)
update!(customer_id, attributes)
update_customer_url()
update_from_transparent_redirect(query_string)

Public Instance Methods
==(other)
credit(transaction_attributes)
credit!(transaction_attributes)
delete()
sale(transaction_attributes)
sale!(transaction_attributes)
transactions(options = {})

Returns a ResourceCollection of transactions for the customer.

update(attributes)
update!(attributes)

© Copyright 2009 Braintree Payment Solutions. All Rights Reserved.