Balances

Overview

Balances show per-currency available funds. Transactions is the operations feed — one row per settled money event with gross, fee, and net amounts.

Balances show the current available and pending funds per currency in your merchant account. The transactions feed records every settled money event — invoice payments, payouts, refunds, conversions — with a breakdown of gross amount, fees, and net amount credited or debited.

Balance object

FieldTypeDescription
currencystringCrypto currency code
networkstringBlockchain network
availablestringSpendable balance (decimal string)
pendingstringFunds held for in-flight payouts or refunds

Transaction object

Each transaction row is one settled money event:

FieldTypeDescription
iduuidOperation UUID
kindstringEvent kind: invoice_payment, payout, refund, recovery, conversion
money_statusstringpending, posted, or reversed
currencystringPrimary currency of the operation
gross_amountstringFull amount moved before fees (decimal string)
fee_totalstringTotal fees across the operation (decimal string)
net_amountstringAmount after fees (decimal string)
invoice_iduuid | nullLinked invoice UUID for payment events; null otherwise
source_typestringDomain entity type the event was recorded for
source_iduuidDomain entity UUID
counter_currencystring | nullCounter currency for conversions; null for single-currency events
counter_amountstring | nullCounter amount for conversions (decimal string)
ratestring | nullConversion rate (decimal string); null for single-currency events
amount_usdstring | nullUSD equivalent at event time
created_atdatetimeEvent timestamp

Postings (drill-down)

Fetching a single transaction via GET /v1/transactions/{operationID} returns the same fields plus a postings array — the individual accounting lines that make up the event:

FieldTypeDescription
entry_typestringAccounting entry type (e.g. invoice_credit, invoice_service_fee, conversion_out, conversion_in, payout_reserve)
amountstringPositive decimal-string amount
directionstringcredit or debit
currencystringPosting currency
payerstring | nullFee payer on fee lines: merchant, payer, or halfin. null on non-fee postings

Example: invoice payment postings

entry_type              amount      direction   payer
invoice_credit          100.00      credit      —
invoice_service_fee       0.49      debit       merchant

Example: conversion postings

entry_type              amount      currency    direction   payer
conversion_out          100.00      USDT        debit       —
conversion_in            92.00      EUR         credit      —
conversion_fee            0.50      EUR         debit       merchant

When to use each surface

SurfaceUse
GET /v1/balancesCheck current spendable funds before creating a payout
GET /v1/transactionsReconcile your ledger — keyset-paginated feed of all events
GET /v1/transactions/{operationID}Drill down into one event to see per-fee accounting lines

The balance.credited webhook

Use balance.credited as the fulfillment signal when you need to confirm that spendable balance is available — not just that an invoice payment was confirmed. A confirmed invoice payment credits the merchant balance after platform fees are deducted. The webhook payload includes gross_amount, fee_amount, and net_amount.

import { createHalfin, listBalances, listTransactions } from '@halfin/sdk-merchant';

const client = createHalfin({ apiKey: process.env.HALFIN_API_KEY! });

const { data: balances } = await listBalances({ client });
const { data: txns } = await listTransactions({ client, query: { limit: 50 } });

Reconciliation notes

The transactions feed uses keyset pagination. Pass the previous response's next_cursor back as the cursor parameter to page forward. Do not use offset pagination for reconciliation — it can produce gaps or duplicates during concurrent inserts.

  • Do not calculate spendable funds from webhook totals alone — fees, reversals, and late payments affect the balance independently.
  • Treat invoice.paid as payment confirmation; use balance.credited when fulfillment depends on spendable balance availability.
  • Reversals and late payments are reconciliation events that adjust balance after the fact — they appear as separate transaction rows with money_status: reversed or as new invoice_payment rows.
  • Each transaction's gross_amount, fee_total, and net_amount are always consistent with its postings — use the postings drill-down for per-fee attribution.

Methods