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

# Close Receipt

> Close an existing receipt with payment methods and closing timestamp

## Purpose

Close an existing receipt by updating its payment methods and setting the closing timestamp. This endpoint is used to finalize a receipt that was previously created but not yet closed.

## HTTP Request

```http theme={null}
POST https://integrations.clopos.com/open-api/v2/receipts/{id}/close
```

<Warning>
  This endpoint requires authentication. Include your JWT in the `x-token` header. See [Authentication](/authentication) for how to obtain a token and [Errors](/errors) for error responses.
</Warning>

## Path Parameters

| Parameter | Type   | Description                                |
| --------- | ------ | ------------------------------------------ |
| `id`      | number | Unique identifier of the receipt to close. |

## Request Body

| Field             | Type   | Required | Description                                                                                             |
| ----------------- | ------ | -------- | ------------------------------------------------------------------------------------------------------- |
| `payment_methods` | array  | Yes      | List of payment methods with amounts. See [Payment method](/common-objects#payment-method-in-receipts). |
| `closed_at`       | string | No       | Closing timestamp (YYYY-MM-DD HH:mm:ss). Defaults to current time if omitted.                           |

### `payment_methods[]`

| Field    | Type   | Required | Description                                 |
| -------- | ------ | -------- | ------------------------------------------- |
| `id`     | number | Yes      | Payment method ID.                          |
| `name`   | string | Yes      | Payment method name (e.g., "Cash", "Card"). |
| `amount` | number | Yes      | Amount paid using this method.              |

## Request Example

<CodeGroup>
  ```bash curl theme={null}
  curl --location --request POST 'https://integrations.clopos.com/open-api/v2/receipts/10950/close' \
    --header 'Content-Type: application/json' \
    --header 'x-token: oauth_example_token' \
    --data '{
      "payment_methods": [
        {
          "id": 2,
          "name": "Cash",
          "amount": 8140
        }
      ],
      "closed_at": "2026-01-20 09:59:54"
    }'
  ```

  ```javascript javascript theme={null}
  const receiptId = 10950;

  const response = await fetch(`https://integrations.clopos.com/open-api/v2/receipts/${receiptId}/close`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'x-token': 'oauth_example_token',
    },
    body: JSON.stringify({
      payment_methods: [
        {
          id: 2,
          name: 'Cash',
          amount: 8140
        }
      ],
      closed_at: '2026-01-20 09:59:54'
    })
  });

  const receipt = await response.json();
  ```

  ```python python theme={null}
  import requests

  receipt_id = 10950
  url = f"https://integrations.clopos.com/open-api/v2/receipts/{receipt_id}/close"
  headers = {
      "Content-Type": "application/json",
      "x-token": "oauth_example_token",
  }
  payload = {
      "payment_methods": [
          {
              "id": 2,
              "name": "Cash",
              "amount": 8140
          }
      ],
      "closed_at": "2026-01-20 09:59:54"
  }

  response = requests.post(url, headers=headers, json=payload)
  receipt = response.json()
  ```
</CodeGroup>

## Response

### 200 OK — Receipt Closed

```json theme={null}
{
  "success": true,
  "message": "Receipt closed",
  "data": {
    "id": 10950,
    "closed_at": "2026-01-20 09:59:54",
    "payment_methods": [
      {
        "id": 2,
        "name": "Cash",
        "amount": 8140
      }
    ]
  }
}
```

### 400 Bad Request — Validation Error

```json theme={null}
{
  "success": false,
  "error": "validation_failed",
  "message": "closed_at must be greater than created_at"
}
```

### 404 Not Found — Receipt Not Found

```json theme={null}
{
  "success": false,
  "error": "not_found",
  "message": "Receipt not found"
}
```

## Field Reference

### Response fields

| Field                  | Type    | Description                                                     |
| ---------------------- | ------- | --------------------------------------------------------------- |
| `success`              | boolean | Indicates the result of the request.                            |
| `message`              | string  | Human-readable status message.                                  |
| `data.id`              | number  | Receipt identifier that was closed.                             |
| `data.closed_at`       | string  | Closing timestamp applied to the receipt (YYYY-MM-DD HH:mm:ss). |
| `data.payment_methods` | array   | Payment methods recorded on the receipt.                        |

### `payment_methods[]`

| Field    | Type   | Description                                 |
| -------- | ------ | ------------------------------------------- |
| `id`     | number | Payment method ID.                          |
| `name`   | string | Payment method name (e.g., "Cash", "Card"). |
| `amount` | number | Amount paid using this method.              |

## Notes

* The receipt must be in an open state (`status: 1`) to be closed through this endpoint.
* If `closed_at` is omitted, the server uses the current timestamp.
* The `closed_at` value must be later than the receipt's `created_at` timestamp.
* After closing, the receipt's `status` changes to `2` (closed).
