Nombaone.Settlements (Nomba One v0.1.0)

View Source

Settlements — where collected money lands, and how it leaves (refunds, payouts) under the escrow lock.

Summary

Functions

Withdraw settled funds to your bank account.

List settlements, newest first. Optional filters: :status, :limit, :cursor.

Refund a settlement's tenant share. The platform fee is never refunded. Optional :amount_in_kobo (defaults to the full remaining refundable amount).

Retrieve a settlement by id. Common errors: 404 SETTLEMENT_NOT_FOUND.

Your escrow lock and available-to-withdraw balance.

Functions

create_payout(client, params, opts \\ [])

@spec create_payout(Nombaone.Client.t(), map(), keyword()) ::
  {:ok, Nombaone.Payout.t()} | {:error, Nombaone.Error.t()}

Withdraw settled funds to your bank account.

Pass your own idempotency key

Money moves here, and the Idempotency-Key doubles as the payout's durable merchant_tx_ref. Always pass an explicit, stable idempotency_key: (e.g. your own payout id) — an auto-generated key protects SDK-level retries, but a brand-new process retrying with a fresh key would create a second payout.

Common errors: 409 ESCROW_LOCKED, 422 PAYOUT_EXCEEDS_AVAILABLE.

Example

{:ok, payout} =
  Nombaone.Settlements.create_payout(
    client,
    %{amount_in_kobo: 5_000_000, bank_code: "058", account_number: "0123456789"},
    idempotency_key: "payout-#{my_payout_row.id}"
  )

create_payout!(client, params, opts \\ [])

@spec create_payout!(Nombaone.Client.t(), map(), keyword()) :: Nombaone.Payout.t()

Raising variant of create_payout/3.

list(client, params \\ %{}, opts \\ [])

@spec list(Nombaone.Client.t(), map(), keyword()) ::
  {:ok, Nombaone.Page.t()} | {:error, Nombaone.Error.t()}

List settlements, newest first. Optional filters: :status, :limit, :cursor.

list!(client, params \\ %{}, opts \\ [])

@spec list!(Nombaone.Client.t(), map(), keyword()) :: Nombaone.Page.t()

Raising variant of list/3.

refund(client, id, params \\ %{}, opts \\ [])

@spec refund(Nombaone.Client.t(), String.t(), map(), keyword()) ::
  {:ok, Nombaone.Refund.t()} | {:error, Nombaone.Error.t()}

Refund a settlement's tenant share. The platform fee is never refunded. Optional :amount_in_kobo (defaults to the full remaining refundable amount).

Money moves here. The SDK sends an Idempotency-Key automatically; pass your own stable idempotency_key: so a retry from a new process cannot refund twice.

Common errors: 409 REFUND_ALREADY_REFUNDED, 422 REFUND_AMOUNT_EXCEEDS_NET.

refund!(client, id, params \\ %{}, opts \\ [])

@spec refund!(Nombaone.Client.t(), String.t(), map(), keyword()) ::
  Nombaone.Refund.t()

Raising variant of refund/4.

retrieve(client, id, opts \\ [])

@spec retrieve(Nombaone.Client.t(), String.t(), keyword()) ::
  {:ok, Nombaone.Settlement.t()} | {:error, Nombaone.Error.t()}

Retrieve a settlement by id. Common errors: 404 SETTLEMENT_NOT_FOUND.

retrieve!(client, id, opts \\ [])

Raising variant of retrieve/3.

retrieve_escrow(client, opts \\ [])

@spec retrieve_escrow(
  Nombaone.Client.t(),
  keyword()
) :: {:ok, Nombaone.Escrow.t()} | {:error, Nombaone.Error.t()}

Your escrow lock and available-to-withdraw balance.

retrieve_escrow!(client, opts \\ [])

@spec retrieve_escrow!(
  Nombaone.Client.t(),
  keyword()
) :: Nombaone.Escrow.t()

Raising variant of retrieve_escrow/2.