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

# Wallet & Credit Logic

> How financial settlements work in Travomatrix

Travomatrix uses a "Prepaid + Credit Limit" model to manage agency balances.

## Balance Calculation

An agent's available purchasing power is calculated as:
`Available Funds = Wallet Balance + Credit Limit`

* **Wallet Balance**: The actual cash deposited by the agent.
* **Credit Limit**: A buffer allowed by the platform administrator.

## Transaction Types

### DEBIT

Occurs when a booking is created. The `net_fare` is deducted from the balance. If the balance goes negative, it uses the credit limit.

### CREDIT

Manual top-up by the administrator when an agent pays.

### REFUND

Automatically triggered on successful cancellation. The amount credited is the original `net_fare` minus penalties.

## Atomicity and Safety

All wallet operations are atomic and wrapped in database transactions. This prevents "double-spending" or balance drift during high-concurrency booking attempts.
