Unit.API.Sandbox (Unit v1.0.0)

Copy Markdown View Source

Sandbox simulation endpoints for testing Unit integrations.

All sandbox endpoints require a valid Bearer token (same auth as live API). The sandbox base URL is https://api.s.unit.sh.

Available simulations

  • Applications: approve, deny, approve/reject/require-review documents
  • Accounts: interest accrual, NSF simulation, statement generation
  • Payments: incoming ACH, incoming wire, ACH return, ACH clear
  • Cards: authorization, authorization decline, purchase, reversal, ATM
  • Check Deposits: clear, reject, return
  • Check Payments: process, return
  • Credit: credit limit change
  • Received Payments: advance

Summary

Functions

Trigger interest accrual on a deposit account.

Advance a received ACH payment (simulate early-access to incoming funds).

Approve an application in the sandbox.

Simulate an ATM withdrawal.

Simulate a card purchase authorization (creates a pending Authorization).

Simulate a credit limit change on a credit account.

Simulate an ACH payment clearing (Pending → Sent).

Simulate clearing a check deposit (AwaitingImages → Clearing → Sent).

Simulate a card authorization being declined.

Deny an application in the sandbox.

Generate a monthly statement for an account in sandbox.

Simulate a check payment being processed (New/Pending → Processed).

Simulate a settled card purchase (no authorization step).

Simulate receiving an incoming ACH payment.

Simulate receiving an incoming wire payment.

Simulate rejecting a check deposit.

Set an application document to RequireAdditionalReview.

Simulate an ACH payment being returned.

Simulate returning a cleared check deposit.

Simulate a check payment being returned.

Simulate a card reversal.

Simulate an NSF event on an account.

Functions

accrue_interest(account_id, opts \\ [])

@spec accrue_interest(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, term()}

Trigger interest accrual on a deposit account.

advance_received_payment(received_payment_id, opts \\ [])

@spec advance_received_payment(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, term()}

Advance a received ACH payment (simulate early-access to incoming funds).

Required params

  • :received_payment_id

approve_application(application_id, opts \\ [])

@spec approve_application(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, term()}

Approve an application in the sandbox.

approve_document(application_id, document_id, opts \\ [])

@spec approve_document(String.t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, term()}

Approve an application document.

atm_withdrawal(params, opts \\ [])

@spec atm_withdrawal(
  map(),
  keyword()
) :: {:ok, map()} | {:error, term()}

Simulate an ATM withdrawal.

Required params

  • :card_id, :amount, :atm_name

Optional

  • :atm_location, :surcharge

authorize_card(params, opts \\ [])

@spec authorize_card(
  map(),
  keyword()
) :: {:ok, map()} | {:error, term()}

Simulate a card purchase authorization (creates a pending Authorization).

Required params

  • :card_id, :amount

Optional

  • :merchant (%{name:, type:, category:, location:}), :recurring, :tags

change_credit_limit(params, opts \\ [])

@spec change_credit_limit(
  map(),
  keyword()
) :: {:ok, map()} | {:error, term()}

Simulate a credit limit change on a credit account.

Required params

  • :credit_account_id, :credit_limit (new limit in cents)

clear_ach(payment_id, opts \\ [])

@spec clear_ach(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, term()}

Simulate an ACH payment clearing (Pending → Sent).

Required params

  • :payment_id

clear_check_deposit(params, opts \\ [])

@spec clear_check_deposit(
  map(),
  keyword()
) :: {:ok, map()} | {:error, term()}

Simulate clearing a check deposit (AwaitingImages → Clearing → Sent).

Required params

  • :check_deposit_id

Optional

  • :status"Clearing" (default) or "Sent"

decline_authorization(params, opts \\ [])

@spec decline_authorization(
  map(),
  keyword()
) :: {:ok, map()} | {:error, term()}

Simulate a card authorization being declined.

Required params

  • :card_id, :amount, :reason

Optional

  • :merchant

deny_application(application_id, opts \\ [])

@spec deny_application(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, term()}

Deny an application in the sandbox.

generate_statement(account_id, opts \\ [])

@spec generate_statement(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, term()}

Generate a monthly statement for an account in sandbox.

process_check_payment(check_payment_id, opts \\ [])

@spec process_check_payment(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, term()}

Simulate a check payment being processed (New/Pending → Processed).

Required params

  • :check_payment_id

purchase_card(params, opts \\ [])

@spec purchase_card(
  map(),
  keyword()
) :: {:ok, map()} | {:error, term()}

Simulate a settled card purchase (no authorization step).

Required params

  • :card_id, :amount

Optional

  • :merchant, :tags

receive_ach(params, opts \\ [])

@spec receive_ach(
  map(),
  keyword()
) :: {:ok, map()} | {:error, term()}

Simulate receiving an incoming ACH payment.

Required params

  • :account_id, :amount, :direction ("Credit" or "Debit"), :description

Optional

  • :sec_code, :counterparty, :same_day, :tags

receive_wire(params, opts \\ [])

@spec receive_wire(
  map(),
  keyword()
) :: {:ok, map()} | {:error, term()}

Simulate receiving an incoming wire payment.

Required params

  • :account_id, :amount, :description

Optional

  • :originating_fi, :tags

reject_check_deposit(params, opts \\ [])

@spec reject_check_deposit(
  map(),
  keyword()
) :: {:ok, map()} | {:error, term()}

Simulate rejecting a check deposit.

Required params

  • :check_deposit_id, :reason

reject_document(application_id, document_id, reason, opts \\ [])

@spec reject_document(String.t(), String.t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, term()}

Reject an application document.

require_review_document(application_id, document_id, opts \\ [])

@spec require_review_document(String.t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, term()}

Set an application document to RequireAdditionalReview.

return_ach(params, opts \\ [])

@spec return_ach(
  map(),
  keyword()
) :: {:ok, map()} | {:error, term()}

Simulate an ACH payment being returned.

Fires the payment.returned webhook and creates a Returned ACH Transaction.

Required params

  • :payment_id
  • :return_reason_code — e.g. "R01" (NSF), "R02" (closed), "R10" (unauthorized)

return_check_deposit(params, opts \\ [])

@spec return_check_deposit(
  map(),
  keyword()
) :: {:ok, map()} | {:error, term()}

Simulate returning a cleared check deposit.

Required params

  • :check_deposit_id, :reason

return_check_payment(params, opts \\ [])

@spec return_check_payment(
  map(),
  keyword()
) :: {:ok, map()} | {:error, term()}

Simulate a check payment being returned.

Required params

  • :check_payment_id, :return_reason

reverse_card(params, opts \\ [])

@spec reverse_card(
  map(),
  keyword()
) :: {:ok, map()} | {:error, term()}

Simulate a card reversal.

Required params

  • :amount
  • :authorization_id OR :transaction_id

simulate_nsf(params, opts \\ [])

@spec simulate_nsf(
  map(),
  keyword()
) :: {:ok, map()} | {:error, term()}

Simulate an NSF event on an account.

Required params

  • :account_id, :amount