Moov.Accounts (Moov v1.0.0)

Copy Markdown View Source

Create and manage Moov accounts - the core entity representing your platform, or one of your platform's merchants/users.

See https://docs.moov.io/api/moov-accounts/accounts/.

Summary

Functions

Creates an account.

Shares a connection with another account, e.g. so a partner platform can see one of your merchant accounts. params takes :account_id (the account to connect with) among other fields documented by Moov.

Generates a terms-of-service token, used in create/2's :terms_of_service when collecting acceptance via Moov.js rather than recording it manually.

Deletes an account.

Retrieves a single account by ID.

Lists accounts accessible to your platform.

Lists accounts connected to the given account.

Updates an account. params accepts the same shape as create/2's :profile/:settings/:customer_support (partial updates are merged).

Functions

create(client, params)

@spec create(Moov.Client.t(), map()) :: {:ok, map()} | {:error, Moov.Error.t()}

Creates an account.

params (snake_case keys are camelCased automatically, see Moov.CaseConverter):

  • :account_type - "individual" or "business" (required)
  • :profile - %{individual: %{...}} or %{business: %{...}} (required). Individual profiles take :name (:first_name, :last_name, optional :middle_name/:suffix), :email, :phone, :address, :birth_date, :government_id. Business profiles take :legal_business_name, :business_type ("soleProprietorship", "llc", "partnership", "privateCorporation", "publicCorporation", "trust", ...), :address, :phone, :email, :website, :tax_id, :industry_codes, :industry
  • :capabilities - capabilities to request immediately, e.g. ["transfers", "wallet", "send-funds", "collect-funds"] (optional - see Moov.Capabilities.create/3 to request these later instead)
  • :terms_of_service - %{token: token} from Moov.js, or %{manual: %{accepted_date: ..., accepted_ip: ..., accepted_user_agent: ..., accepted_domain: ...}}. Required before enabling wallet, send-funds, collect-funds, or card-issuing
  • :settings - e.g. %{ach_payment: %{company_name: "..."}, card_payment: %{statement_descriptor: "..."}}
  • :customer_support - business-only: phone/email/address/website shown on card transactions
  • :foreign_id - your own identifier for this account
  • :mode - "sandbox" or "production" (facilitator/top-level accounts only - sub-accounts inherit the facilitator's mode)

Requires scope /accounts.write.

Examples

Moov.Accounts.create(client, %{
  account_type: "business",
  profile: %{
    business: %{
      legal_business_name: "Whole Body Fitness LLC",
      business_type: "llc",
      email: "ops@wholebodyfitness.example"
    }
  }
})

create_connection(client, account_id, params)

@spec create_connection(Moov.Client.t(), String.t(), map()) ::
  {:ok, map()} | {:error, Moov.Error.t()}

Shares a connection with another account, e.g. so a partner platform can see one of your merchant accounts. params takes :account_id (the account to connect with) among other fields documented by Moov.

create_tos_token(client, opts \\ [])

@spec create_tos_token(
  Moov.Client.t(),
  keyword()
) :: {:ok, map()} | {:error, Moov.Error.t()}

Generates a terms-of-service token, used in create/2's :terms_of_service when collecting acceptance via Moov.js rather than recording it manually.

delete(client, account_id)

@spec delete(Moov.Client.t(), String.t()) :: {:ok, term()} | {:error, Moov.Error.t()}

Deletes an account.

get(client, account_id)

@spec get(Moov.Client.t(), String.t()) :: {:ok, map()} | {:error, Moov.Error.t()}

Retrieves a single account by ID.

list(client, opts \\ [])

@spec list(
  Moov.Client.t(),
  keyword()
) :: {:ok, [map()]} | {:error, Moov.Error.t()}

Lists accounts accessible to your platform.

Supported opts[:query] filters include :name, :email, :type, :foreign_id, :include_disabled, :count, :skip.

list_connected_accounts(client, account_id, opts \\ [])

@spec list_connected_accounts(Moov.Client.t(), String.t(), keyword()) ::
  {:ok, [map()]} | {:error, Moov.Error.t()}

Lists accounts connected to the given account.

update(client, account_id, params)

@spec update(Moov.Client.t(), String.t(), map()) ::
  {:ok, map()} | {:error, Moov.Error.t()}

Updates an account. params accepts the same shape as create/2's :profile/:settings/:customer_support (partial updates are merged).