Drives Treasury Prime's sandbox-only simulation endpoint, which lets
you force state transitions and synthetic events that would otherwise
require waiting on a real bank/network partner — e.g. moving an ACH
straight to "settled", simulating a card authorization request,
triggering a FedNow receipt, or completing a Green Dot cash load.
Calling any of these against a :production client will simply fail (the
endpoint doesn't exist outside sandbox) — there's no special guard here,
Treasury Prime itself enforces this.
Generic usage
{:ok, result} =
TreasuryPrime.Testing.Simulation.create(client, "card_event.auth_request", %{
amount: "25.10",
card_id: "card_104",
merchant: %{
name: "KROGER #10626",
mcc: "5411",
mid: "4445025949032",
address: %{city: "LAS VEGAS", state: "NV", postal_code: "88901", country: "USA"}
}
})See Treasury Prime's per-resource simulation guides (ACH, Card, Check
Deposit, Check Issuing, Digital Wallet Token, FedNow, Green Dot,
Statement, Wire) for the exhaustive, current list of type values and
the simulation fields each one accepts — they evolve over time and are
documented per-resource rather than in one combined schema.
A handful of the most common ones are wrapped below for convenience.
Summary
Functions
Forces an ACH transfer through a status transition (e.g. "settled", "returned").
Simulates an incoming card authorization request against card_id, as
if it came from the card network in real time — useful for testing
TreasuryPrime.CardAuthLoopEndpoint integrations or card control logic
without a real card present.
Forces a check deposit through a status transition (e.g. "accepted", "rejected").
Creates a simulation event of the given type, with simulation as the
type-specific input payload. This is the fully general escape hatch —
prefer the convenience functions below when one fits your case.
Simulates an incoming FedNow payment to account_id.
Completes a pending Green Dot cash load as if the customer paid at the register.
Forces a wire transfer through a status transition.
Functions
@spec ach_status(TreasuryPrime.Client.t(), String.t(), String.t()) :: {:ok, map()} | {:error, TreasuryPrime.Error.t()}
Forces an ACH transfer through a status transition (e.g. "settled", "returned").
@spec card_auth_request(TreasuryPrime.Client.t(), String.t(), map()) :: {:ok, map()} | {:error, TreasuryPrime.Error.t()}
Simulates an incoming card authorization request against card_id, as
if it came from the card network in real time — useful for testing
TreasuryPrime.CardAuthLoopEndpoint integrations or card control logic
without a real card present.
@spec check_deposit_status(TreasuryPrime.Client.t(), String.t(), String.t()) :: {:ok, map()} | {:error, TreasuryPrime.Error.t()}
Forces a check deposit through a status transition (e.g. "accepted", "rejected").
@spec create(TreasuryPrime.Client.t(), String.t(), map()) :: {:ok, map()} | {:error, TreasuryPrime.Error.t()}
Creates a simulation event of the given type, with simulation as the
type-specific input payload. This is the fully general escape hatch —
prefer the convenience functions below when one fits your case.
@spec fednow_receive(TreasuryPrime.Client.t(), String.t(), String.t()) :: {:ok, map()} | {:error, TreasuryPrime.Error.t()}
Simulates an incoming FedNow payment to account_id.
@spec greendot_complete(TreasuryPrime.Client.t(), String.t()) :: {:ok, map()} | {:error, TreasuryPrime.Error.t()}
Completes a pending Green Dot cash load as if the customer paid at the register.
@spec wire_status(TreasuryPrime.Client.t(), String.t(), String.t()) :: {:ok, map()} | {:error, TreasuryPrime.Error.t()}
Forces a wire transfer through a status transition.