Braintree v0.4.0 Braintree.Customer

You can create a customer by itself, with a payment method, or with a credit card with a billing address.

For additional reference see: https://developers.braintreepayments.com/reference/request/customer/create/ruby

Summary

Functions

Create a customer record, or return an error response with after failed validation

You can delete a customer using its ID. When a customer is deleted, all associated payment methods are also deleted, and all associated recurring billing subscriptions are canceled

To update a customer, use its ID along with new attributes. The same validations apply as when creating a customer. Any attribute not passed will remain unchanged

Types

t :: %Braintree.Customer{addresses: [], coinbase_accounts: [], company: String.t, created_at: String.t, credit_cards: [], custom_fields: %{}, email: String.t, fax: String.t, first_name: String.t, id: String.t, last_name: String.t, paypal_accounts: [], phone: String.t, updated_at: String.t, website: String.t}

Functions

create(params \\ %{})

Specs

create(Map.t) ::
  {:ok, t} |
  {:error, Braintree.ErrorResponse.t}

Create a customer record, or return an error response with after failed validation.

Example

{:ok, customer} = Braintree.Customer.create(%{
  first_name: "Jen",
  last_name: "Smith",
  company: "Braintree",
  email: "jen@example.com",
  phone: "312.555.1234",
  fax: "614.555.5678",
  website: "www.example.com"
})

customer.company # Braintree
delete(id)

Specs

delete(binary) :: :ok | :error

You can delete a customer using its ID. When a customer is deleted, all associated payment methods are also deleted, and all associated recurring billing subscriptions are canceled.

Example

:ok = Braintree.Customer.delete("customer_id")
update(id, params)

Specs

update(binary, Map.t) ::
  {:ok, t} |
  {:error, Braintree.ErrorResponse.t}

To update a customer, use its ID along with new attributes. The same validations apply as when creating a customer. Any attribute not passed will remain unchanged.

Example

{:ok, customer} = Braintree.Customer.update("customer_id", %{
  company: "New Company Name"
})

customer.company # "New Company Name"