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 GPA orders for a user.
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
@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.
Creates a new GPA order. Raises Marqeta.Error on failure.
@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.
Retrieves a GPA order by token. Raises Marqeta.Error on failure.
@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.
Lists GPA order resources. Raises Marqeta.Error on failure.
@spec list_by_business(String.t(), map(), keyword()) :: {:ok, map()} | {:error, Marqeta.Error.t()}
Lists GPA orders for a business.
@spec list_by_user(String.t(), map(), keyword()) :: {:ok, map()} | {:error, Marqeta.Error.t()}
Lists GPA orders for a user.
@spec list_unloads(String.t(), map(), keyword()) :: {:ok, map()} | {:error, Marqeta.Error.t()}
Lists unloads (reversals) for a GPA order.
@spec stream( map(), keyword() ) :: Enumerable.t()
Returns a lazy Stream that auto-paginates GPA order resources.
@spec unload(String.t(), map(), keyword()) :: {:ok, map()} | {:error, Marqeta.Error.t()}
Unloads (reverses) funds from a GPA order.