# Payments

Manage standalone payment records for your property. Payments can be optionally linked to a **Booking** (`bid`) or a **Guest** (`gid`).

***

## List Payments

Retrieve a list of payment records for the property.

#### Endpoint

```http
GET /api/v1/client/payments
```

#### Query Parameters

* `bid` (optional): Filter payments by Booking UUID.

#### Example Response

```json
[
  {
    "id": "7b9e2f12-34cd-4e89-bf45-4a18f5a8a1f0",
    "bid": "e7b7f6bb-6c0c-4e2c-9b3e-9c6f2a1c0a77",
    "gid": "7f99c230-8f64-4ecb-8804-d9ea5496bf63",
    "amount": "260.0000",
    "paymentMethod": "POS",
    "type": "income",
    "description": "Room upgrade fee",
    "name": "Front Desk Payment",
    "date": "2025-10-02T11:00:00Z",
    "status": true
  }
]
```

***

## Create Payment

Log a new payment or expense.

#### Endpoint

```http
POST /api/v1/client/payments
```

#### Request Payload

| Field           | Type   | Description                                                                    |
| --------------- | ------ | ------------------------------------------------------------------------------ |
| `amount`        | string | **Required**. Decimal amount (e.g., "260.00").                                 |
| `paymentMethod` | string | **Required**. (Choices: `Cash`, `Bank Transfer`, `Credit Card`, `POS`, `OTA`). |
| `type`          | string | **Required**. (Choices: `income`, `outgoing`).                                 |
| `bid`           | string | Optional Booking UUID. Automatically links to the booking's guest.             |
| `gid`           | string | Optional Guest UUID (if not linking to a booking).                             |
| `name`          | string | Optional name for the record (default: "Client API Payment").                  |
| `description`   | string | Optional internal notes.                                                       |

#### Example `curl`

```bash
curl "/api/v1/client/payments" \
  -X POST \
  -H "content-type: application/json" \
  -H "X-API-Key: <your_api_key>" \
  -d '{
    "amount": "150.00",
    "paymentMethod": "Cash",
    "type": "income",
    "bid": "e7b7f6bb-6c0c-4e2c-9b3e-9c6f2a1c0a77",
    "description": "Deposit for extra night"
  }'
```

***

## Update Payment

Modify an existing payment record.

#### Endpoint

```http
PATCH /api/v1/client/payments/{paymentId}
```

> **Note**: This is a partial update. Only send the fields you wish to change.

***

## Delete Payment (Soft Delete)

Deactivate a payment record.

#### Endpoint

```http
DELETE /api/v1/client/payments/{paymentId}
```

> **Soft Delete**: This operation sets the payment `status` to `false`. It is hidden from standard views but remains in the database for financial audit purposes.
