# Payment types

Each purchase has to be paid using various methods, including cash, payment cards, vouchers, and more. These payment methods are collectively referred to as "payment types" and are represented by the [`PaymentType`](/data-models.md#paymenttype) class.

## API methods

## Get payment types

<mark style="color:blue;">`GET`</mark> `http://{server-address}/paymenttypes`

Returns all payment types that matches query parameters. Result is of type [`QueryResult<PaymentType>`](/data-models.md#queryresult).

#### Query Parameters

| Name         | Type                | Description                                                                                                              |
| ------------ | ------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| number       | int                 | Supports NData syntax.                                                                                                   |
| isActive     | bool                | Supports NData syntax.                                                                                                   |
| $skip        | int                 | Pagination property. Describing number of records to skip from beginning of result collection.                           |
| $take        | int                 | Pagination property. Maximum count of items to be returned.                                                              |
| $sort        | string\[]           | <p>Comma separated list of property names. Please see NData syntax.<br></p>                                              |
| $count       | bool                | If set to `true`, response will not contain `items` collection. Use to get resource count, not the resources themselves. |
| category     | PaymentTypeCategory | Supports NData syntax.                                                                                                   |
| isChangeable | bool                | Supports NData syntax.                                                                                                   |

#### Headers

| Name                                            | Type   | Description                                    |
| ----------------------------------------------- | ------ | ---------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | string | Authorization header with authorization token. |

{% tabs %}
{% tab title="200: OK Successful response" %}

```javascript
{
    "items":
    [
        {
            "number": 1,
            "category": "Cash",
            "isActive": true,
            "description": "Hotovosť",
            "isChangeable": true,
            "_v": 1
        },
        {
            "number": 2,
            "category": "CreditCard",
            "isActive": true,
            "description": "Platobná karta",
            "isChangeable": false,
            "_v": 2
        },
        {
            "number": 3,
            "category": "Other",
            "isActive": false,
            "description": "Šek",
            "isChangeable": false,
            "_v": 1
        },
        {
            "number": 4,
            "category": "Other",
            "isActive": false,
            "description": "Gastrolístky",
            "isChangeable": false,
            "_v": 1
        },
        {
            "number": 5,
            "category": "Other",
            "isActive": false,
            "description": "Iné",
            "isChangeable": false,
            "_v": 1
        },
        {
            "number": 6,
            "category": "Other",
            "isActive": true,
            "description": "Wolt",
            "isChangeable": false,
            "_v": 2
        },
        {
            "number": 7,
            "category": "Other",
            "isActive": true,
            "description": "Bolt",
            "isChangeable": false,
            "_v": 1
        },
        {
            "number": 8,
            "category": "Other",
            "isActive": true,
            "description": "Foodora",
            "isChangeable": false,
            "_v": 2
        },
        {
            "number": 9,
            "category": "Other",
            "isActive": true,
            "description": "Bistro.sk",
            "isChangeable": false,
            "_v": 2
        },
        {
            "number": 10,
            "category": "Other",
            "isActive": false,
            "description": "Adaptee",
            "isChangeable": false,
            "_v": 1
        }
    ],
    "count": 10,
    "totalCount": 10
}
```

{% endtab %}
{% endtabs %}

## Get payment type by number

<mark style="color:blue;">`GET`</mark> `http://{server-address}/paymenttypes/{number}`

Result is of type [PaymentType](/data-models.md#paymenttype).

#### Path Parameters

| Name                                     | Type | Description                 |
| ---------------------------------------- | ---- | --------------------------- |
| number<mark style="color:red;">\*</mark> | int  | Unique payment type number. |

#### Headers

| Name                                            | Type   | Description                                    |
| ----------------------------------------------- | ------ | ---------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | string | Authorization header with authorization token. |

{% tabs %}
{% tab title="200: OK Resource found." %}

```javascript
{
    "number": 1,
    "category": "Cash",
    "isActive": true,
    "description": "Hotovosť",
    "isChangeable": true,
    "_v": 1
}
```

{% endtab %}

{% tab title="404: Not Found Payment type with given number is not found." %}

```javascript
{
    "title": "Zdroj nebol nájdený",
    "status": 404
}
```

{% endtab %}
{% endtabs %}

## Create payment type

<mark style="color:green;">`POST`</mark> `http://{server-address}/paymenttypes`

Creates new payment type. Result is of type [PaymentType](/data-models.md#paymenttype).

**Required rights**

Authorized user must have `PaymentTypeCreate` [right ](/user-rights.md)assigned.

#### Headers

| Name                                            | Type   | Description                                    |
| ----------------------------------------------- | ------ | ---------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | string | Authorization header with authorization token. |

#### Request Body

| Name                                     | Type        | Description     |
| ---------------------------------------- | ----------- | --------------- |
| (body)<mark style="color:red;">\*</mark> | PaymentType | Model to create |

{% tabs %}
{% tab title="201: Created Successfuly created." %}

```javascript
{
    "number": 1,
    "category": "Cash",
    "isActive": true,
    "description": "Hotovosť",
    "isChangeable": true,
    "_v": 1
}
```

{% endtab %}
{% endtabs %}

## Create or update payment type

<mark style="color:orange;">`PUT`</mark> `http://{server-address}/paymenttypes/{number}`

Updates existing or creates new payment type. Result is of type [PaymentType](/data-models.md#paymenttype).

**Required rights**

Authorized user must have assigned `PaymentTypeCreate` or `PaymentTypeUpdate` [right](/user-rights.md).

#### Path Parameters

| Name                                     | Type | Description                 |
| ---------------------------------------- | ---- | --------------------------- |
| number<mark style="color:red;">\*</mark> | int  | Unique payment type number. |

#### Headers

| Name                                            | Type   | Description                                    |
| ----------------------------------------------- | ------ | ---------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | string | Authorization header with authorization token. |

#### Request Body

| Name                                     | Type        | Description                    |
| ---------------------------------------- | ----------- | ------------------------------ |
| (body)<mark style="color:red;">\*</mark> | PaymentType | The model to create or update. |

{% tabs %}
{% tab title="200: OK Successfuly created or updated." %}

```javascript
{
    "number": 1,
    "category": "Cash",
    "isActive": true,
    "description": "Hotovosť",
    "isChangeable": true,
    "_v": 2
}
```

{% endtab %}
{% endtabs %}

## Delete payment type by number

<mark style="color:red;">`DELETE`</mark> `http://{server-address}/paymenttypes/{number}`

**Required rights**

Authorized user must have `PaymentTypeDelete` [right ](/user-rights.md)assigned.

#### Path Parameters

| Name                                     | Type | Description                 |
| ---------------------------------------- | ---- | --------------------------- |
| number<mark style="color:red;">\*</mark> | int  | Unique payment type number. |

#### Headers

| Name                                            | Type   | Description                                    |
| ----------------------------------------------- | ------ | ---------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | string | Authorization header with authorization token. |

{% tabs %}
{% tab title="200: OK Successfuly deleted." %}

```javascript
{
    "number": 1,
    "category": "Cash",
    "isActive": true,
    "description": "Hotovosť",
    "isChangeable": true,
    "_v": 1
}
```

{% endtab %}

{% tab title="404: Not Found Given resource was not found." %}

```javascript
{
    "title": "Zdroj nebol nájdený",
    "status": 404
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.portos.sk/api-reference/payment-types.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
