Marqeta.Users (marqeta v1.0.0)

Copy Markdown View Source

Manage individual cardholders (users) on the Marqeta platform.

User states

  • UNVERIFIED — created, identity not yet verified
  • LIMITED — partial verification; restricted transaction access
  • ACTIVE — fully verified and operational
  • SUSPENDED — temporarily frozen; no transactions permitted
  • CLOSED — permanently closed

Identification types

SSN, PASSPORT, DRIVERS_LICENSE, SIN, TIN, CPF

Example

{:ok, user} = Marqeta.Users.create(%{
  first_name: "Jane",
  last_name: "Doe",
  email: "jane@example.com",
  address1: "123 Main St",
  city: "San Francisco",
  state: "CA",
  postal_code: "94105",
  country: "USA",
  birth_date: "1990-01-15",
  identifications: [%{type: "SSN", value: "123456789"}]
})

Summary

Functions

Returns the GPA balance for a user.

Creates a new user.

Creates a new user. Raises Marqeta.Error on failure.

Creates a note on a user.

Retrieves a user by token.

Retrieves a user by token. Raises Marqeta.Error on failure.

Retrieves KYC verification status for a user.

Lists user resources.

Lists user resources. Raises Marqeta.Error on failure.

Lists addresses associated with a user.

Lists all cards belonging to a user.

Lists child users of a parent user (for hierarchical account structures).

Lists MSA (Merchant-Specific Account) balances for a user.

Searches for users by one or more criteria (email, first_name, last_name, phone, ssn).

Searches for users. Raises Marqeta.Error on failure.

Generates a single sign-on (SSO) token for the cardholder portal.

Returns a lazy Stream that auto-paginates user resources.

Returns a lazy stream of all cards for a user.

Returns a lazy stream of all transactions for a user.

Lists transactions for a user.

Updates an existing user.

Updates an existing user. Raises Marqeta.Error on failure.

Functions

balances(token, opts \\ [])

@spec balances(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, Marqeta.Error.t()}

Returns the GPA balance for a user.

create(params \\ %{}, opts \\ [])

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

Creates a new user.

Returns {:ok, map()} on success, {:error, %Marqeta.Error{}} on failure.

create!(params \\ %{}, opts \\ [])

@spec create!(
  map(),
  keyword()
) :: map()

Creates a new user. Raises Marqeta.Error on failure.

create_note(token, params, opts \\ [])

@spec create_note(String.t(), map(), keyword()) ::
  {:ok, map()} | {:error, Marqeta.Error.t()}

Creates a note on a user.

get(token, opts \\ [])

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

Retrieves a user by token.

Returns {:ok, map()} on success, {:error, %Marqeta.Error{}} on failure.

get!(token, opts \\ [])

@spec get!(
  String.t(),
  keyword()
) :: map()

Retrieves a user by token. Raises Marqeta.Error on failure.

kyc_status(token, opts \\ [])

@spec kyc_status(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, Marqeta.Error.t()}

Retrieves KYC verification status for a user.

list(params \\ %{}, opts \\ [])

@spec list(
  map(),
  keyword()
) :: {:ok, map()} | {:error, Marqeta.Error.t()}

Lists user resources.

Accepts standard Marqeta pagination params: count, start_index, sort_by, sort_order, fields.

Use stream/2 to lazily iterate all pages automatically.

list!(params \\ %{}, opts \\ [])

@spec list!(
  map(),
  keyword()
) :: map()

Lists user resources. Raises Marqeta.Error on failure.

list_addresses(token, params \\ %{}, opts \\ [])

@spec list_addresses(String.t(), map(), keyword()) ::
  {:ok, map()} | {:error, Marqeta.Error.t()}

Lists addresses associated with a user.

list_by_account_holder_group(group_token, params \\ %{}, opts \\ [])

@spec list_by_account_holder_group(String.t(), map(), keyword()) ::
  {:ok, map()} | {:error, Marqeta.Error.t()}

Lists users in an account holder group.

list_cards(token, params \\ %{}, opts \\ [])

@spec list_cards(String.t(), map(), keyword()) ::
  {:ok, map()} | {:error, Marqeta.Error.t()}

Lists all cards belonging to a user.

list_children(token, params \\ %{}, opts \\ [])

@spec list_children(String.t(), map(), keyword()) ::
  {:ok, map()} | {:error, Marqeta.Error.t()}

Lists child users of a parent user (for hierarchical account structures).

list_msa_balances(token, params \\ %{}, opts \\ [])

@spec list_msa_balances(String.t(), map(), keyword()) ::
  {:ok, map()} | {:error, Marqeta.Error.t()}

Lists MSA (Merchant-Specific Account) balances for a user.

list_notes(token, params \\ %{}, opts \\ [])

@spec list_notes(String.t(), map(), keyword()) ::
  {:ok, map()} | {:error, Marqeta.Error.t()}

Lists notes on a user.

search(params, opts \\ [])

@spec search(
  map(),
  keyword()
) :: {:ok, map()} | {:error, Marqeta.Error.t()}

Searches for users by one or more criteria (email, first_name, last_name, phone, ssn).

search!(params, opts \\ [])

@spec search!(
  map(),
  keyword()
) :: map()

Searches for users. Raises Marqeta.Error on failure.

sso_token(token, params \\ %{}, opts \\ [])

@spec sso_token(String.t(), map(), keyword()) ::
  {:ok, map()} | {:error, Marqeta.Error.t()}

Generates a single sign-on (SSO) token for the cardholder portal.

stream(params \\ %{}, opts \\ [])

@spec stream(
  map(),
  keyword()
) :: Enumerable.t()

Returns a lazy Stream that auto-paginates user resources.

stream_cards(token, params \\ %{})

@spec stream_cards(String.t(), map()) :: Enumerable.t()

Returns a lazy stream of all cards for a user.

stream_transactions(token, params \\ %{})

@spec stream_transactions(String.t(), map()) :: Enumerable.t()

Returns a lazy stream of all transactions for a user.

transactions(token, params \\ %{}, opts \\ [])

@spec transactions(String.t(), map(), keyword()) ::
  {:ok, map()} | {:error, Marqeta.Error.t()}

Lists transactions for a user.

update(token, params, opts \\ [])

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

Updates an existing user.

Returns {:ok, map()} on success, {:error, %Marqeta.Error{}} on failure.

update!(token, params, opts \\ [])

@spec update!(String.t(), map(), keyword()) :: map()

Updates an existing user. Raises Marqeta.Error on failure.

update_note(user_token, note_token, params, opts \\ [])

@spec update_note(String.t(), String.t(), map(), keyword()) ::
  {:ok, map()} | {:error, Marqeta.Error.t()}

Updates a note on a user.