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:
- A new entry is created with reversed party roles and opposite type
- The refund entry is created in
PENDING - Both entries are linked via
relatedEntryId - The original entry is only marked as
VOIDEDwhen 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
VOIDEDentry (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
PENDINGand 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
EXPENSEentries - 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
Tracking Related Entries
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:
| Event | Description |
|---|---|
REFUNDED | Recorded on the original entry |
VOIDED | Recorded on the original entry when it's voided |
REIMBURSED | Recorded on the expense entry |
CREATED | Recorded on the new refund/reimbursement entry with relation data |
Related Pages
- Entries — entry statuses and relation types
- Entries API — refund and reimbursement endpoints