Skip to main content

Refunds & Reimbursements

Moonlight supports two types of linked financial operations: refunds (reversing a transaction) and reimbursements (paying back an employee).

Refunds

A refund reverses an entry (any non-voided status). When a refund is created:

  1. A new entry is created with reversed party roles and opposite type
  2. The refund entry is created in PENDING
  3. Both entries are linked via relatedEntryId
  4. The original entry is only marked as VOIDED when the refund is a full refund

Refund Flow

Partial Refunds

You can specify a lower amountCents for partial refunds:

POST /entries/42/refund
{
"amountCents": 25000,
"description": "Partial refund - 50% returned"
}

Partial refunds do not void the original entry. They create a linked reverse entry while leaving the original entry active.

Constraints

  • Cannot refund a VOIDED entry (including previously refunded entries, since they become voided)
  • Refund amount must be greater than zero
  • Refund amount cannot exceed the original entry amount
  • Full refunds void the original entry; partial refunds do not
  • Refund entries start in PENDING and must go through normal review/sync flow
  • Refund creation is blocked when the new refund date falls inside a closed accounting period

Reimbursements

A reimbursement pays back an employee for expenses they incurred on behalf of the organization.

Reimbursement Flow

API

POST /entries/42/reimburse
{
"amountCents": 15000,
"fromPartyId": 1,
"toPartyId": 3,
"description": "Taxi reimbursement for business trip"
}

Reimbursement Constraints

  • Reimbursements can only be created from EXPENSE entries
  • Reimbursement amount must be greater than zero
  • Reimbursement amount cannot exceed the original expense amount
  • Reimbursement entries start in PENDING
  • Reimbursement creation is blocked when the reimbursement date falls inside a closed accounting period

To find all entries related to a specific entry:

GET /entries/{id}/related

This returns all entries that have relatedEntryId pointing to the specified entry.

Audit Trail

All operations generate events:

EventDescription
REFUNDEDRecorded on the original entry
VOIDEDRecorded on the original entry when it's voided
REIMBURSEDRecorded on the expense entry
CREATEDRecorded on the new refund/reimbursement entry with relation data
  • Entries — entry statuses and relation types
  • Entries API — refund and reimbursement endpoints