Unit.API.CheckPayments (Unit v1.0.0)

Copy Markdown View Source

API module for Unit Check Payments (print-and-mail outgoing checks).

Not enabled by default — contact Unit to enable for your organization.

Flow

  1. Create a check payment → status: New
  2. Unit prints and mails the check → status: PendingClearingProcessed
  3. A CheckPaymentTransaction debits the deposit account on processing.

Summary

Functions

Cancel a check payment (only in New or Pending status).

Create an outgoing check payment.

Get a check payment by ID.

Get the back image of a processed check.

Get the front image of a processed check.

List check payments.

Return a processed check payment.

Functions

cancel(id, opts \\ [])

@spec cancel(
  String.t(),
  keyword()
) :: {:ok, Unit.Resource.CheckPayment.t()} | {:error, term()}

Cancel a check payment (only in New or Pending status).

create(params, opts \\ [])

@spec create(
  map(),
  keyword()
) :: {:ok, Unit.Resource.CheckPayment.t()} | {:error, term()}

Create an outgoing check payment.

Required params

  • :account_id
  • :amount — in cents
  • :description
  • :counterparty%{name:, address:} map (payee)

Optional

  • :memo — memo line on the check
  • :send_dateDate.t() for scheduled delivery
  • :tags
  • :idempotency_key

get(id, opts \\ [])

@spec get(
  String.t(),
  keyword()
) :: {:ok, Unit.Resource.CheckPayment.t()} | {:error, term()}

Get a check payment by ID.

get_back_image(id, opts \\ [])

@spec get_back_image(
  String.t(),
  keyword()
) :: Unit.Client.response()

Get the back image of a processed check.

get_front_image(id, opts \\ [])

@spec get_front_image(
  String.t(),
  keyword()
) :: Unit.Client.response()

Get the front image of a processed check.

list(opts \\ [])

@spec list(keyword()) ::
  {:ok, [Unit.Resource.CheckPayment.t()], map()} | {:error, term()}

List check payments.

Filter options

  • :account_id, :customer_id, :status
  • :since, :until

return(id, return_reason, opts \\ [])

@spec return(String.t(), String.t(), keyword()) ::
  {:ok, Unit.Resource.CheckPayment.t()} | {:error, term()}

Return a processed check payment.