# Payments

Payments of bookings, whether planned, partially paid or paid

Endpoint: `https://api.bookingmood.com/v1/payments`, supporting `GET`, `POST`, `DELETE`, `PATCH`. Authenticate with the header `Authorization: Bearer YOUR_API_KEY` (see [authentication](https://www.bookingmood.com/eu-ES/api-reference/authentication.md)).

## The payment object

| Attribute | Type | Description |
| --- | --- | --- |
| `id` | `uuid` | Unique identifier. |
| `booking_id` | `uuid` | Identifier of the related booking. References [`bookings.id`](https://www.bookingmood.com/eu-ES/api-reference/bookings.md). |
| `invoice_id` | `uuid` | Identifier of the related invoice. References [`invoices.id`](https://www.bookingmood.com/eu-ES/api-reference/invoices.md). |
| `provider_id` | `text \| null` | Identifier of the payment at the payment provider. |
| `created_at` | `timestamp with time zone` | Creation timestamp. Read-only: set by the database. |
| `updated_at` | `timestamp with time zone` | Last modification timestamp. Read-only: set by the database. |
| `amount` | `integer` | Total amount of the payment, in cents. |
| `completed_at` | `timestamp with time zone \| null` | Timestamp at which the payment was completed. |
| `currency` | `Currency` | Currency of the payment. |
| `due_at` | `timestamp with time zone` | Timestamp at which the payment is due. |
| `fts` | `tsvector` | Read-only: set by the database. |
| `notification_sent_at` | `timestamp with time zone \| null` | Timestamp at which the guest was notified of the payment being due. |
| `offline` | `boolean` | Whether the payment is made outside Bookingmood, e.g. by bank transfer. |
| `paid` | `integer` | Amount of the payment that was paid, in cents. |
| `reference` | `text` | Reference of the payment. |
| `status` | `PaymentStatus` | Status of the payment: `due`, `paid` or `cancelled`. Read-only: set by the database. |

```json
{
  "id": "00000000-0000-0000-0000-000000000000",
  "booking_id": "00000000-0000-0000-0000-000000000000",
  "invoice_id": "00000000-0000-0000-0000-000000000000",
  "provider_id": "",
  "created_at": "2026-10-30T23:18:45.588Z",
  "updated_at": "2026-10-30T23:18:45.588Z",
  "amount": 0,
  "completed_at": "2026-10-30T23:18:45.588Z",
  "currency": "ARS",
  "due_at": "2026-10-30T23:18:45.588Z",
  "notification_sent_at": "2026-10-30T23:18:45.588Z",
  "offline": false,
  "paid": 0,
  "reference": "ABC123",
  "status": "cancelled"
}
```

### Types

```typescript
type Currency = 
  | "ARS"
  | "AUD"
  | "BRL"
  | "BYN"
  | "CAD"
  | "CHF"
  | "CLP"
  | "CNY"
  | "COP"
  | "CZK"
  | "DKK"
  | "EGP"
  | "EUR"
  | "GBP"
  | "HKD"
  | "HUF"
  | "ILS"
  | "INR"
  | "JPY"
  | "KRW"
  | "KYD"
  | "MAD"
  | "MXN"
  | "MYR"
  | "NGN"
  | "NOK"
  | "NZD"
  | "PEN"
  | "PHP"
  | "PLN"
  | "RON"
  | "RUB"
  | "SEK"
  | "SGD"
  | "THB"
  | "TRY"
  | "TWD"
  | "UAH"
  | "USD"
  | "XOF"
  | "VND"
  | "ZAR";

type PaymentStatus = "paid" | "due" | "cancelled";
```

### Related resources

Embed related resources with the [`select` parameter](https://www.bookingmood.com/eu-ES/api-reference/selecting.md), e.g. `select=*,bookings(*)`. Resources related through more than one column need the column as a hint, like `table!column(*)`.

| Embed | Type | Description |
| --- | --- | --- |
| `bookings(*)` | `object \| null` | The [booking](https://www.bookingmood.com/eu-ES/api-reference/bookings.md) referenced by `booking_id`. |
| `invoices(*)` | `object \| null` | The [invoice](https://www.bookingmood.com/eu-ES/api-reference/invoices.md) referenced by `invoice_id`. |

## List payments

`GET /v1/payments`

Filter on any attribute with `column=operator.value` (see [filtering](https://www.bookingmood.com/eu-ES/api-reference/filtering.md)). Choose columns and embed related resources with `select` (see [selecting](https://www.bookingmood.com/eu-ES/api-reference/selecting.md)), and sort and paginate with `order`, `limit` and `offset` (see [sorting and pagination](https://www.bookingmood.com/eu-ES/api-reference/sorting-pagination.md)).

```bash
curl -X GET "https://api.bookingmood.com/v1/payments?select=*&limit=10" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

Responses:

- `200`: A list of payments with the selected columns. `206` when the list is a partial range.
- `400`: The request is malformed, for example an unknown column or an invalid filter.
- `401`: The API key is missing or invalid.

## Create payments

`POST /v1/payments`

Insert one payment or an array of payments. The body is a `Partial` payment object, so columns with a default can be left out. Read-only attributes can't be written.

```bash
curl -X POST "https://api.bookingmood.com/v1/payments" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "booking_id": "00000000-0000-0000-0000-000000000000",
    "invoice_id": "00000000-0000-0000-0000-000000000000",
    "amount": 0,
    "currency": "ARS",
    "due_at": "2026-10-30T23:18:45.588Z",
    "offline": false,
    "paid": 0,
    "reference": "ABC123"
  }'
```

Responses:

- `201`: The newly created payments with the selected columns.
- `400`: The request is malformed, for example an unknown column, an invalid filter or an invalid body.
- `401`: The API key is missing or invalid.
- `403`: The API key has no permission for this change, for example when writing rows of another organization.
- `409`: The change conflicts with existing data, for example a duplicate key or a reference to a row that does not exist.

## Delete payments

`DELETE /v1/payments`

Filter on any attribute with `column=operator.value` (see [filtering](https://www.bookingmood.com/eu-ES/api-reference/filtering.md)). Without filters, this request deletes all payments you have access to. Always filter on at least one column, e.g. `id=eq.{id}`.

```bash
curl -X DELETE "https://api.bookingmood.com/v1/payments?id=eq.00000000-0000-0000-0000-000000000000" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

Responses:

- `200`: The deleted payments with the selected columns. `204` without a body when sending the header `Prefer: return=minimal`.
- `400`: The request is malformed, for example an unknown column or an invalid filter.
- `401`: The API key is missing or invalid.
- `403`: The API key has no permission for this change, for example when writing rows of another organization.

## Update payments

`PATCH /v1/payments`

Filter on any attribute with `column=operator.value` (see [filtering](https://www.bookingmood.com/eu-ES/api-reference/filtering.md)). Without filters, this request updates all payments you have access to. Always filter on at least one column, e.g. `id=eq.{id}`. The body holds the attributes to change.

```bash
curl -X PATCH "https://api.bookingmood.com/v1/payments?id=eq.00000000-0000-0000-0000-000000000000" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 0
  }'
```

Responses:

- `200`: The updated payments with the selected columns. `204` without a body when sending the header `Prefer: return=minimal`.
- `400`: The request is malformed, for example an unknown column, an invalid filter or an invalid body.
- `401`: The API key is missing or invalid.
- `403`: The API key has no permission for this change, for example when writing rows of another organization.
- `409`: The change conflicts with existing data, for example a duplicate key or a reference to a row that does not exist.

Errors have a JSON body with a `code`, `message`, `details` and `hint`. See the [introduction](https://www.bookingmood.com/eu-ES/api-reference.md) for more on errors. The full API is described by the OpenAPI spec at https://api.bookingmood.com/v1/openapi.json.
