Unit.API.RecurringRepayments (Unit v1.0.0)

Copy Markdown View Source

API module for Unit Recurring Repayments.

Automates scheduled repayments towards a credit account on a configurable interval.

Types

  • recurringBookRepayment — from a deposit account at the same bank
  • recurringAchRepayment — from an external ACH counterparty
  • recurringCapitalPartnerAchRepayment
  • recurringCapitalPartnerBookRepayment

Summary

Functions

Create a recurring ACH repayment.

Create a recurring book repayment.

Disable a recurring repayment.

Enable a disabled recurring repayment.

Get a recurring repayment by ID.

List recurring repayments.

Functions

create_ach(params, opts \\ [])

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

Create a recurring ACH repayment.

Required params

  • :credit_account_id
  • :amount, :description, :schedule
  • :counterparty_id or :counterparty

Optional

  • :same_day, :idempotency_key

create_book(params, opts \\ [])

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

Create a recurring book repayment.

Required params

  • :credit_account_id
  • :account_id — source deposit account
  • :amount — in cents
  • :description
  • :schedule — schedule map (see Unit.API.RecurringPayments for schedule format)

disable(id, opts \\ [])

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

Disable a recurring repayment.

enable(id, opts \\ [])

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

Enable a disabled recurring repayment.

get(id, opts \\ [])

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

Get a recurring repayment by ID.

list(opts \\ [])

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

List recurring repayments.