Limit how much and how frequently users can spend.
Controls can be scoped to a user, card product, or entire program (null association — requires Program Manager permission).
A program supports up to 90 combined velocity + authorization controls. When multiple controls apply, the user cannot exceed any of them.
Velocity Windows
DAY, WEEK, MONTH, LIFETIME, TRANSACTION
Examples
# $500/day per user
{:ok, _} = Marqeta.VelocityControls.create(%{
association: %{user_token: "user_01"},
currency_code: "USD",
amount_limit: 500.00,
velocity_window: "DAY",
include_purchases: true,
include_withdrawals: true,
include_cashback: false,
include_credits: false,
active: true
})
# 10 transactions/week on a card product
{:ok, _} = Marqeta.VelocityControls.create(%{
association: %{card_product_token: "cp_01"},
currency_code: "USD",
amount_limit: 10_000.00,
transaction_limit: 10,
velocity_window: "WEEK",
active: true
})
Summary
Functions
Creates a new velocity control.
Creates a new velocity control. Raises Marqeta.Error on failure.
Retrieves a velocity control by token.
Retrieves a velocity control by token. Raises Marqeta.Error on failure.
Lists velocity control resources.
Lists velocity control resources. Raises Marqeta.Error on failure.
Returns velocity controls for a card product.
Returns velocity controls available to a user (all applicable controls).
Returns a lazy Stream that auto-paginates velocity control resources.
Updates an existing velocity control.
Updates an existing velocity control. Raises Marqeta.Error on failure.
Functions
@spec create( map(), keyword() ) :: {:ok, map()} | {:error, Marqeta.Error.t()}
Creates a new velocity control.
Returns {:ok, map()} on success, {:error, %Marqeta.Error{}} on failure.
Creates a new velocity control. Raises Marqeta.Error on failure.
@spec get( String.t(), keyword() ) :: {:ok, map()} | {:error, Marqeta.Error.t()}
Retrieves a velocity control by token.
Returns {:ok, map()} on success, {:error, %Marqeta.Error{}} on failure.
Retrieves a velocity control by token. Raises Marqeta.Error on failure.
@spec list( map(), keyword() ) :: {:ok, map()} | {:error, Marqeta.Error.t()}
Lists velocity control resources.
Accepts standard Marqeta pagination params:
count, start_index, sort_by, sort_order, fields.
Use stream/2 to lazily iterate all pages automatically.
Lists velocity control resources. Raises Marqeta.Error on failure.
@spec list_by_card_product(String.t(), map(), keyword()) :: {:ok, map()} | {:error, Marqeta.Error.t()}
Returns velocity controls for a card product.
@spec list_by_user(String.t(), map(), keyword()) :: {:ok, map()} | {:error, Marqeta.Error.t()}
Returns velocity controls available to a user (all applicable controls).
@spec stream( map(), keyword() ) :: Enumerable.t()
Returns a lazy Stream that auto-paginates velocity control resources.
@spec update(String.t(), map(), keyword()) :: {:ok, map()} | {:error, Marqeta.Error.t()}
Updates an existing velocity control.
Returns {:ok, map()} on success, {:error, %Marqeta.Error{}} on failure.
Updates an existing velocity control. Raises Marqeta.Error on failure.