Check issuing — mail a physical paper check from one of your accounts.
Creating a check
{:ok, check} =
TreasuryPrime.Check.create(client, %{
account_id: "acct_1234567890",
amount: "900.00",
memo: "Refund",
message: "Thank you for your business.",
recipient: %{
name: "George Washington",
address: %{
street_line_1: "1600 Pennsylvania Ave.",
city: "Washington",
state: "DC",
postal_code: "20003"
}
}
}, idempotency_key: TreasuryPrime.Idempotency.generate_key())Status lifecycle
pending -> sent -> (cashed, automatically detected) or expired (180
days after issuance if never cashed). A check can only be canceled within
one hour of creation, while still pending; after that, request a
stop_payment instead (moves to stop_payment_pending then
stop_payment).
Summary
Functions
Cancels a check. Only possible within 1 hour of creation, while still pending.
Issues a check. Required: account_id, amount, recipient.
Fetches a single issued check by id.
Lists issued checks.
Requests a stop payment on a check that's already past the pending status.
Updates a check's status. See the module docs for the allowed lifecycle transitions.
Types
@type t() :: %TreasuryPrime.Check{ account_id: String.t() | nil, amount: String.t() | nil, check_number: String.t() | nil, created_at: String.t() | nil, error: String.t() | nil, id: String.t() | nil, memo: String.t() | nil, message: String.t() | nil, org_id: String.t() | nil, recipient: map() | nil, status: String.t() | nil, updated_at: String.t() | nil, userdata: map() | nil }
Functions
@spec cancel(TreasuryPrime.Client.t(), String.t()) :: {:ok, t()} | {:error, TreasuryPrime.Error.t()}
Cancels a check. Only possible within 1 hour of creation, while still pending.
@spec create(TreasuryPrime.Client.t(), map(), keyword()) :: {:ok, t()} | {:error, TreasuryPrime.Error.t()}
Issues a check. Required: account_id, amount, recipient.
@spec create!(TreasuryPrime.Client.t(), map(), keyword()) :: t()
@spec get(TreasuryPrime.Client.t(), String.t()) :: {:ok, t()} | {:error, TreasuryPrime.Error.t()}
Fetches a single issued check by id.
@spec get!(TreasuryPrime.Client.t(), String.t()) :: t()
@spec list(TreasuryPrime.Client.t(), map()) :: {:ok, TreasuryPrime.Page.t()} | {:error, TreasuryPrime.Error.t()}
Lists issued checks.
Filterable params
account_id, status.
@spec list!(TreasuryPrime.Client.t(), map()) :: TreasuryPrime.Page.t()
@spec stop_payment(TreasuryPrime.Client.t(), String.t()) :: {:ok, t()} | {:error, TreasuryPrime.Error.t()}
Requests a stop payment on a check that's already past the pending status.
@spec update(TreasuryPrime.Client.t(), String.t(), map()) :: {:ok, t()} | {:error, TreasuryPrime.Error.t()}
Updates a check's status. See the module docs for the allowed lifecycle transitions.
@spec update!(TreasuryPrime.Client.t(), String.t(), map()) :: t()