Create and manage credit accounts (the core object of the credit platform).
A credit account centres around a single credit line, accessed by one or more cards. APR, fees, and rewards are inherited from the bundle's policies.
Credit Limit
Range: 0–1,000,000. Required at creation.
Config Fields
billing_cycle_day— Day of month billing closes (1–28)payment_due_interval— Days after billing close that payment is duee_disclosure_active— Electronic disclosure consentcard_level—PREMIUM,TRADITIONAL, orNA
Examples
{:ok, account} = Marqeta.Credit.Accounts.create(%{
user_token: "user_01",
bundle_token: "bundle_01",
credit_limit: 5_000.00,
config: %{
billing_cycle_day: 1,
payment_due_interval: 25,
e_disclosure_active: true,
card_level: "TRADITIONAL"
}
})
Summary
Functions
Returns the current balance for a credit account.
Creates a new credit account.
Creates a new credit account. Raises Marqeta.Error on failure.
Retrieves a credit account by token.
Retrieves a credit account by token. Raises Marqeta.Error on failure.
Lists credit account resources.
Lists credit account resources. Raises Marqeta.Error on failure.
Lists credit accounts for a business.
Lists credit accounts for a user.
Returns a lazy Stream that auto-paginates credit account resources.
Streams credit accounts for a user.
Updates an existing credit account.
Updates an existing credit account. Raises Marqeta.Error on failure.
Functions
@spec balance( String.t(), keyword() ) :: {:ok, map()} | {:error, Marqeta.Error.t()}
Returns the current balance for a credit account.
@spec create( map(), keyword() ) :: {:ok, map()} | {:error, Marqeta.Error.t()}
Creates a new credit account.
Returns {:ok, map()} on success, {:error, %Marqeta.Error{}} on failure.
Creates a new credit account. Raises Marqeta.Error on failure.
@spec get( String.t(), keyword() ) :: {:ok, map()} | {:error, Marqeta.Error.t()}
Retrieves a credit account by token.
Returns {:ok, map()} on success, {:error, %Marqeta.Error{}} on failure.
Retrieves a credit account by token. Raises Marqeta.Error on failure.
@spec list( map(), keyword() ) :: {:ok, map()} | {:error, Marqeta.Error.t()}
Lists credit account resources.
Accepts standard Marqeta pagination params:
count, start_index, sort_by, sort_order, fields.
Use stream/2 to lazily iterate all pages automatically.
Lists credit account resources. Raises Marqeta.Error on failure.
@spec list_by_business(String.t(), map(), keyword()) :: {:ok, map()} | {:error, Marqeta.Error.t()}
Lists credit accounts for a business.
@spec list_by_user(String.t(), map(), keyword()) :: {:ok, map()} | {:error, Marqeta.Error.t()}
Lists credit accounts for a user.
@spec stream( map(), keyword() ) :: Enumerable.t()
Returns a lazy Stream that auto-paginates credit account resources.
@spec stream_by_user(String.t(), map()) :: Enumerable.t()
Streams credit accounts for a user.
@spec update(String.t(), map(), keyword()) :: {:ok, map()} | {:error, Marqeta.Error.t()}
Updates an existing credit account.
Returns {:ok, map()} on success, {:error, %Marqeta.Error{}} on failure.
Updates an existing credit account. Raises Marqeta.Error on failure.