What is a refund in a ledger?

Refund

A refund is a new transaction that sends value back along a path you already posted. It does not delete the original. The original stays. The refund points at it as its parent. Rails may also refund; your book still needs its own record.

How does a refund work?

You identify the applied transfer. The ledger posts the opposite movement: the old destination becomes the source. Amounts match unless you refund a part. The customer sees money back. The book sees two transactions, not one edited row.

Refund vs void

Void cancels an inflight hold before it settles. Refund reverses a transfer that already applied. If the money never committed, void it. If it committed, refund it. Using refund on a voided id, or void on an applied id, is the wrong tool.

What about the rail?

ACH, cards, and some instant rails have their own refund or return. That is a second event. Record it when the rail confirms, the same way you recorded the original. Do not assume the rail refund posted because you posted one in the ledger.

In Blnk you refund by transaction id. The refund stores the original as parent_transaction. Voided inflight records are not refunded; void them, or refund the parent that applied. See refunds.