Expense model represents a single expense transaction within a group. It tracks who paid, the amount, and how the expense should be split among group members.
Data Class Definition
Expense.kt
Fields
String
default:"\"\""
Unique identifier for the expense
String
default:"\"\""
ID of the group this expense belongs to. Serialized as
group_id in JSON/database.String
default:"\"\""
Name of the merchant or description of the expense (e.g., “Grocery Store”, “Dinner at Restaurant”)
Long
default:"0L"
Total amount of the expense in cents. Serialized as
amount_cents in JSON/database.String
default:"\"EQUAL\""
Method for splitting the expense among members. Common values:
"EQUAL"- Split evenly among all participants"PERCENTAGE"- Split by custom percentages"EXACT"- Split by exact amounts
split_method in JSON/database.String
default:"\"USD\""
Three-letter ISO currency code for the transaction
String
default:"\"\""
User ID of the member who paid for the expense. Serialized as
paid_by_user_id in JSON/database.String
default:"\"\""
ISO timestamp when the expense was created. Serialized as
created_at in JSON/database.Serialization
TheExpense model uses Kotlin Serialization with snake_case field names for database compatibility:
Related Models
GroupExpense
For a more comprehensive expense model with split details, see GroupExpense. TheGroupExpense model extends Expense with:
- Detailed split information per user
titlefield instead ofmerchant- List of
ExpenseSplitobjects
ExpenseSplit
From [GroupExpense.kt]:Split
A simpler split model used in some contexts:Split.kt