> ## Documentation Index
> Fetch the complete documentation index at: https://memberpulseptyltd.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Unearned Revenue

> Revenue recognition tracking for annual memberships

Revenue recognition tracking for annual memberships

Tracks revenue recognition for annual membership payments.

## Fields

### Core Fields

| Field               | Type    | Required | Description              |
| ------------------- | ------- | -------- | ------------------------ |
| id                  | UUID    | Auto     | Primary key              |
| membershipPaymentId | UUID    | Yes      | FK to PaymentTransaction |
| financialYear       | integer | Yes      | Financial year           |
| totalAnnualAmount   | decimal | Yes      | Total payment amount     |
| monthlyAmount       | decimal | Auto     | Monthly recognition      |
| startMonth          | integer | Yes      | First month (1-12)       |
| endMonth            | integer | Yes      | Last month (1-12)        |

### Allocation Tracking

| Field               | Type | Required | Description      |
| ------------------- | ---- | -------- | ---------------- |
| recognitionSchedule | json | Auto     | Monthly schedule |

## Recognition Schedule Structure

```json theme={null}
[
  {
    "month": "2025-01",
    "amount": 99.17,
    "recognized": true,
    "recognizedAt": "2025-01-31T23:59:59Z"
  },
  {
    "month": "2025-02",
    "amount": 99.17,
    "recognized": false,
    "recognizedAt": null
  }
]
```

## Business Rules

* Created only for annual membership payments
* Monthly amount = totalAnnualAmount / 12
* Splits across financial years if payment spans them
* Integrates with Xero for accounting sync

## Features

### Unearned Revenue

#### Acceptance Criteria

##### Frontend

* [ ] Admin/client UI can view and manage `Unearned Revenue` records where applicable.

##### Backend / API

* [ ] CRUD operations exist for `Unearned Revenue` (create, read, update, delete/archive).

##### Permissions

* [ ] Access is restricted to appropriate roles (tenant-scoped).

##### Business Rules

* [ ] Fields and relationships documented on this page are enforced for `Unearned Revenue`.

##### Error Handling

* [ ] Invalid payloads return field-level validation errors.
