TreasuryPrime.NetworkTransfer (TreasuryPrime v1.0.0)

Copy Markdown View Source

Network transfers move funds between two accounts you're authorized on, whether they sit at the same bank or at different banks within your Treasury Prime OneKey banking network — settling in near real time. They are Treasury Prime's answer to "book transfer, but the two accounts don't have to share a bank." Setting this up typically requires coordinating reserve/settlement accounts with Treasury Prime and your bank partners.

This module targets the v2 endpoint (POST /v2/network_transfer), which is what Treasury Prime recommends for new integrations. The original v1 endpoint (POST /network_transfer, using sender_account_id/receiver_account_id field names) still exists for backwards compatibility — use create_v1/3 if you specifically need it.

Creating a transfer

{:ok, transfer} =
  TreasuryPrime.NetworkTransfer.create(client, %{
    from_account_id: "acct_1234567890",
    to_account_id: "acct_0987654321",
    amount: "100.00",
    description: "Transfer"
  }, idempotency_key: TreasuryPrime.Idempotency.generate_key())

Summary

Functions

Creates a network transfer via the v2 endpoint. Required: from_account_id, to_account_id, amount.

Creates a network transfer via the legacy v1 endpoint (POST /network_transfer), which uses sender_account_id / receiver_account_id instead of from_account_id / to_account_id. Prefer create/3 for new integrations.

Fetches a single network transfer by id.

Lists network transfers.

Updates a network transfer.

Types

t()

@type t() :: %TreasuryPrime.NetworkTransfer{
  amount: String.t() | nil,
  created_at: String.t() | nil,
  cross_bank: boolean() | nil,
  description: String.t() | nil,
  error: String.t() | nil,
  estimated_settlement_at: String.t() | nil,
  from_account_id: String.t() | nil,
  id: String.t() | nil,
  status: String.t() | nil,
  to_account_id: String.t() | nil,
  updated_at: String.t() | nil,
  userdata: map() | nil
}

Functions

create(client, params, opts \\ [])

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

Creates a network transfer via the v2 endpoint. Required: from_account_id, to_account_id, amount.

create!(client, params, opts \\ [])

@spec create!(TreasuryPrime.Client.t(), map(), keyword()) :: t()

create_v1(client, params, opts \\ [])

@spec create_v1(TreasuryPrime.Client.t(), map(), keyword()) ::
  {:ok, t()} | {:error, TreasuryPrime.Error.t()}

Creates a network transfer via the legacy v1 endpoint (POST /network_transfer), which uses sender_account_id / receiver_account_id instead of from_account_id / to_account_id. Prefer create/3 for new integrations.

get(client, id)

@spec get(TreasuryPrime.Client.t(), String.t()) ::
  {:ok, t()} | {:error, TreasuryPrime.Error.t()}

Fetches a single network transfer by id.

get!(client, id)

@spec get!(TreasuryPrime.Client.t(), String.t()) :: t()

list(client, params \\ %{})

@spec list(TreasuryPrime.Client.t(), map()) ::
  {:ok, TreasuryPrime.Page.t()} | {:error, TreasuryPrime.Error.t()}

Lists network transfers.

Filterable params

from_account_id, to_account_id, status.

list!(client, params \\ %{})

update(client, id, params)

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

Updates a network transfer.

update!(client, id, params)

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