Marqeta.GPAOrders (marqeta v1.0.0)

Copy Markdown View Source

Load and unload funds in user and business General Purpose Accounts (GPAs).

Examples

# Load $100 into a user's GPA
{:ok, order} = Marqeta.GPAOrders.create(%{
  user_token: "user_01",
  amount: 100.00,
  currency_code: "USD",
  funding_source_token: "program_fs_01",
  memo: "Welcome bonus"
})

# Unload (reverse) a GPA order
{:ok, _} = Marqeta.GPAOrders.unload(order["token"], %{
  original_order_token: order["token"],
  amount: 100.00,
  currency_code: "USD",
  funding_source_token: "program_fs_01"
})

Summary

Functions

Creates a new GPA order.

Creates a new GPA order. Raises Marqeta.Error on failure.

Retrieves a GPA order by token.

Retrieves a GPA order by token. Raises Marqeta.Error on failure.

Lists GPA order resources.

Lists GPA order resources. Raises Marqeta.Error on failure.

Lists GPA orders for a business.

Lists unloads (reversals) for a GPA order.

Returns a lazy Stream that auto-paginates GPA order resources.

Unloads (reverses) funds from a GPA order.

Functions

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

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

Creates a new GPA order.

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

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

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

Creates a new GPA order. Raises Marqeta.Error on failure.

get(token, opts \\ [])

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

Retrieves a GPA order by token.

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

get!(token, opts \\ [])

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

Retrieves a GPA order by token. Raises Marqeta.Error on failure.

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

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

Lists GPA order 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 GPA order resources. Raises Marqeta.Error on failure.

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

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

Lists GPA orders for a business.

list_by_user(user_token, params \\ %{}, opts \\ [])

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

Lists GPA orders for a user.

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

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

Lists unloads (reversals) for a GPA order.

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

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

Returns a lazy Stream that auto-paginates GPA order resources.

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

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

Unloads (reverses) funds from a GPA order.