# Payment method

::: info
Каждый ответ приходит в общем конверте — `code`, `message`, `messages`, `status_code`, `time` — а полезная нагрузка лежит в `data`. Таблицы ниже описывают содержимое `data`.
:::

## POST /payment-method/create

This method allows adding payment-method into the account.

**Нужное разрешение:** `payment_methods` · [как работают разрешения](https://docs.bito.uz/ru/api/permissions.md)

**Пример запроса**

::: code-group

```bash [curl]
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/payment-method/create' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "string"
}'
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/payment-method/create', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "name": "string"
  }),
})
const { code, data } = await res.json()
```

```python [Python]
import os
import requests

res = requests.request(
    "POST",
    "https://api.bito.uz/integration-api/integration/api/v2/payment-method/create",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "name": "string",
    },
)
print(res.json())
```

```php [PHP]
<?php
$body = <<<'JSON'
{
  "name": "string"
}
JSON;

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/payment-method/create');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => ['api-key: ' . getenv('BITO_API_KEY'), 'Content-Type: application/json'],
    CURLOPT_POSTFIELDS => $body,
    CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);
```

:::

**Тело запроса**

| Поле | Тип | Обязательно | Описание |
|---|---|---|---|
| `name` | `string` | Да |  |
| `shortcut` | `string` | Нет | Keyboard shortcut on the POS, `F1`–`F12`. |
| `type` | `string` | Нет | Only `cashless` can be created. Every account has exactly one `cash` method, created by the system; sending `cash` returns a validation error.. Допустимые значения: `cashless`. По умолчанию: `"cashless"` |
| `subtype` | `string` | Нет | Finer classification of a `cashless` method: `terminal`, `online`, `bank` or `bnpl`. `cash` takes no subtype. Omit or send `null` to leave the method unclassified.. Допустимые значения: `terminal`, `online`, `bank`, `bnpl` |
| `commission_type` | `string` | Нет | Допустимые значения: `variable`, `fixed`, `none` |
| `commission_rate` | `number` | Нет | Required when `commission_type` is `fixed` or `variable`. |
| `commission_rate_min` | `number` | Нет | Required when `commission_type` is `variable`. |
| `commission_rate_max` | `number` | Нет | Required when `commission_type` is `variable`. |
| `commission_payment_type_id` | `string` | Нет | Required when `commission_type` is `fixed` or `variable`. |
| `commission_direction` | `string` | Нет | Required when `commission_type` is `fixed` or `variable`.. Допустимые значения: `income`, `expense`, `both` |

```json
{
  "name": "string",
  "shortcut": "F8",
  "type": "cashless",
  "subtype": "terminal",
  "commission_type": "variable",
  "commission_rate": 0,
  "commission_rate_min": 0,
  "commission_rate_max": 0,
  "commission_payment_type_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "commission_direction": "income"
}
```

**Ответ**

| Поле | Тип | Описание |
|---|---|---|
| `_id` | `string` |  |
| `name` | `string` |  |
| `shortcut` | `string` |  |
| `type` | `string` | `cash` (exactly one per account, created by the system) or `cashless`. Earlier versions of the API also returned `card`, `terminal`, `transfer`, `gift`, `integration` — these are now `cashless`, described by `subtype` and `is_integration`.. Допустимые значения: `cash`, `cashless` |
| `subtype` | `string` | Classification of a `cashless` method. `null` when the method is `cash` or has not been classified yet.. Допустимые значения: `terminal`, `online`, `bank`, `bnpl` |
| `is_integration` | `boolean` | The method was created by a payment integration (Payme, Click, …) rather than by a person. Replaces the old `integration` type.. По умолчанию: `false` |
| `is_enabled` | `boolean` | По умолчанию: `true` |
| `is_default` | `boolean` | По умолчанию: `false` |
| `is_visible` | `boolean` | По умолчанию: `false` |
| `created_at` | `string (date-time)` |  |
| `updated_at` | `string (date-time)` |  |

```json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "_id": "string",
    "name": "string",
    "shortcut": "string",
    "type": "cash",
    "subtype": "terminal",
    "is_integration": false,
    "is_enabled": true,
    "is_default": false,
    "is_visible": false,
    "created_at": "2025-05-01T12:00:00Z",
    "updated_at": "2025-05-01T12:00:00Z"
  },
  "time": "2025-05-01T12:00:00Z"
}
```

## PUT /payment-method/update

This method allows updating payment-method in the account.

**Нужное разрешение:** `payment_methods` · [как работают разрешения](https://docs.bito.uz/ru/api/permissions.md)

**Пример запроса**

::: code-group

```bash [curl]
curl -X PUT 'https://api.bito.uz/integration-api/integration/api/v2/payment-method/update' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "string",
  "_id": "67b486d242ed76693cd2cc59"
}'
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/payment-method/update', {
  method: 'PUT',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "name": "string",
    "_id": "67b486d242ed76693cd2cc59"
  }),
})
const { code, data } = await res.json()
```

```python [Python]
import os
import requests

res = requests.request(
    "PUT",
    "https://api.bito.uz/integration-api/integration/api/v2/payment-method/update",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "name": "string",
        "_id": "67b486d242ed76693cd2cc59",
    },
)
print(res.json())
```

```php [PHP]
<?php
$body = <<<'JSON'
{
  "name": "string",
  "_id": "67b486d242ed76693cd2cc59"
}
JSON;

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/payment-method/update');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'PUT',
    CURLOPT_HTTPHEADER => ['api-key: ' . getenv('BITO_API_KEY'), 'Content-Type: application/json'],
    CURLOPT_POSTFIELDS => $body,
    CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);
```

:::

**Тело запроса**

| Поле | Тип | Обязательно | Описание |
|---|---|---|---|
| `name` | `string` | Да |  |
| `shortcut` | `string` | Нет | Keyboard shortcut on the POS, `F1`–`F12`. |
| `type` | `string` | Нет | Optional; omit it to keep the current type. A method cannot be changed to or from `cash`: a `type` that would do so is ignored and the rest of the update is applied.. Допустимые значения: `cash`, `cashless` |
| `subtype` | `string` | Нет | Finer classification of a `cashless` method: `terminal`, `online`, `bank` or `bnpl`. `cash` takes no subtype. Omit or send `null` to leave the method unclassified.. Допустимые значения: `terminal`, `online`, `bank`, `bnpl` |
| `_id` | `string` | Да |  |
| `commission_type` | `string` | Нет | Допустимые значения: `variable`, `fixed`, `none` |
| `commission_rate` | `number` | Нет | Required when `commission_type` is `fixed` or `variable`. |
| `commission_rate_min` | `number` | Нет | Required when `commission_type` is `variable`. |
| `commission_rate_max` | `number` | Нет | Required when `commission_type` is `variable`. |
| `commission_payment_type_id` | `string` | Нет | Required when `commission_type` is `fixed` or `variable`. |
| `commission_direction` | `string` | Нет | Required when `commission_type` is `fixed` or `variable`.. Допустимые значения: `income`, `expense`, `both` |

```json
{
  "name": "string",
  "shortcut": "F8",
  "type": "cash",
  "subtype": "terminal",
  "_id": "67b486d242ed76693cd2cc59",
  "commission_type": "variable",
  "commission_rate": 0,
  "commission_rate_min": 0,
  "commission_rate_max": 0,
  "commission_payment_type_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "commission_direction": "income"
}
```

**Ответ**

Структура ответа совпадает с [POST /payment-method/create](#post-payment-method-create).

## DELETE /payment-method/delete/{id}

Delete a payment-method

**Нужное разрешение:** `payment_methods` · [как работают разрешения](https://docs.bito.uz/ru/api/permissions.md)

**Пример запроса**

::: code-group

```bash [curl]
curl -X DELETE 'https://api.bito.uz/integration-api/integration/api/v2/payment-method/delete/6712f0a9c4d1e87b3a0f9911' \
  -H "api-key: $BITO_API_KEY"
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/payment-method/delete/6712f0a9c4d1e87b3a0f9911', {
  method: 'DELETE',
  headers: { 'api-key': process.env.BITO_API_KEY },
})
const { code, data } = await res.json()
```

```python [Python]
import os
import requests

res = requests.request(
    "DELETE",
    "https://api.bito.uz/integration-api/integration/api/v2/payment-method/delete/6712f0a9c4d1e87b3a0f9911",
    headers={"api-key": os.environ["BITO_API_KEY"]},
)
print(res.json())
```

```php [PHP]
<?php
$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/payment-method/delete/6712f0a9c4d1e87b3a0f9911');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'DELETE',
    CURLOPT_HTTPHEADER => ['api-key: ' . getenv('BITO_API_KEY')],
    CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);
```

:::

**Параметры пути**

| Параметр | Тип | Обязательно | Описание |
|---|---|---|---|
| `id` | `string` | Да |  |

**Тело запроса**

Тело запроса не требуется.

**Ответ**

```json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": "ok",
  "time": "2025-05-01T12:00:00Z"
}
```

## GET /payment-method/get-all

Get all payment-methods

**Нужное разрешение:** `payment_methods` · [как работают разрешения](https://docs.bito.uz/ru/api/permissions.md)

**Пример запроса**

::: code-group

```bash [curl]
curl -X GET 'https://api.bito.uz/integration-api/integration/api/v2/payment-method/get-all' \
  -H "api-key: $BITO_API_KEY"
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/payment-method/get-all', {
  method: 'GET',
  headers: { 'api-key': process.env.BITO_API_KEY },
})
const { code, data } = await res.json()
```

```python [Python]
import os
import requests

res = requests.request(
    "GET",
    "https://api.bito.uz/integration-api/integration/api/v2/payment-method/get-all",
    headers={"api-key": os.environ["BITO_API_KEY"]},
)
print(res.json())
```

```php [PHP]
<?php
$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/payment-method/get-all');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => ['api-key: ' . getenv('BITO_API_KEY')],
    CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);
```

:::

**Параметры запроса**

| Параметр | Тип | Обязательно | Описание |
|---|---|---|---|
| `is_enabled` | `boolean` | Нет | Filter payment-methods by enabled status |

**Тело запроса**

Тело запроса не требуется.

**Ответ**

```json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": [
    {
      "_id": "string",
      "name": "string",
      "shortcut": "string",
      "type": "cash",
      "subtype": "terminal",
      "is_integration": false,
      "is_enabled": true,
      "is_default": false,
      "is_visible": false,
      "created_at": "2025-05-01T12:00:00Z",
      "updated_at": "2025-05-01T12:00:00Z"
    }
  ],
  "time": "2025-05-01T12:00:00Z"
}
```

## GET /payment-method/get-by-id/{id}

Get payment-method using its _id

**Нужное разрешение:** `payment_methods` · [как работают разрешения](https://docs.bito.uz/ru/api/permissions.md)

**Пример запроса**

::: code-group

```bash [curl]
curl -X GET 'https://api.bito.uz/integration-api/integration/api/v2/payment-method/get-by-id/6712f0a9c4d1e87b3a0f9911' \
  -H "api-key: $BITO_API_KEY"
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/payment-method/get-by-id/6712f0a9c4d1e87b3a0f9911', {
  method: 'GET',
  headers: { 'api-key': process.env.BITO_API_KEY },
})
const { code, data } = await res.json()
```

```python [Python]
import os
import requests

res = requests.request(
    "GET",
    "https://api.bito.uz/integration-api/integration/api/v2/payment-method/get-by-id/6712f0a9c4d1e87b3a0f9911",
    headers={"api-key": os.environ["BITO_API_KEY"]},
)
print(res.json())
```

```php [PHP]
<?php
$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/payment-method/get-by-id/6712f0a9c4d1e87b3a0f9911');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => ['api-key: ' . getenv('BITO_API_KEY')],
    CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);
```

:::

**Параметры пути**

| Параметр | Тип | Обязательно | Описание |
|---|---|---|---|
| `id` | `string` | Да |  |

**Тело запроса**

Тело запроса не требуется.

**Ответ**

Структура ответа совпадает с [POST /payment-method/create](#post-payment-method-create).

## GET /payment-method/get-deleted

Get deleted payment-method ids

**Нужное разрешение:** `payment_methods` · [как работают разрешения](https://docs.bito.uz/ru/api/permissions.md)

**Пример запроса**

::: code-group

```bash [curl]
curl -X GET 'https://api.bito.uz/integration-api/integration/api/v2/payment-method/get-deleted?deleted_at=DELETED_AT' \
  -H "api-key: $BITO_API_KEY"
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/payment-method/get-deleted?deleted_at=DELETED_AT', {
  method: 'GET',
  headers: { 'api-key': process.env.BITO_API_KEY },
})
const { code, data } = await res.json()
```

```python [Python]
import os
import requests

res = requests.request(
    "GET",
    "https://api.bito.uz/integration-api/integration/api/v2/payment-method/get-deleted?deleted_at=DELETED_AT",
    headers={"api-key": os.environ["BITO_API_KEY"]},
)
print(res.json())
```

```php [PHP]
<?php
$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/payment-method/get-deleted?deleted_at=DELETED_AT');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => ['api-key: ' . getenv('BITO_API_KEY')],
    CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);
```

:::

**Параметры запроса**

| Параметр | Тип | Обязательно | Описание |
|---|---|---|---|
| `deleted_at` | `string` | Да |  |

**Тело запроса**

Тело запроса не требуется.

**Ответ**

```json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": [
    "string"
  ],
  "time": "2025-05-01T12:00:00Z"
}
```

## PUT /payment-method/set-active

This method allows setActive payment-method in the account.

**Нужное разрешение:** `payment_methods` · [как работают разрешения](https://docs.bito.uz/ru/api/permissions.md)

**Пример запроса**

::: code-group

```bash [curl]
curl -X PUT 'https://api.bito.uz/integration-api/integration/api/v2/payment-method/set-active' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "_id": "67b486d242ed76693cd2cc59",
  "is_enabled": true
}'
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/payment-method/set-active', {
  method: 'PUT',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "_id": "67b486d242ed76693cd2cc59",
    "is_enabled": true
  }),
})
const { code, data } = await res.json()
```

```python [Python]
import os
import requests

res = requests.request(
    "PUT",
    "https://api.bito.uz/integration-api/integration/api/v2/payment-method/set-active",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "_id": "67b486d242ed76693cd2cc59",
        "is_enabled": True,
    },
)
print(res.json())
```

```php [PHP]
<?php
$body = <<<'JSON'
{
  "_id": "67b486d242ed76693cd2cc59",
  "is_enabled": true
}
JSON;

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/payment-method/set-active');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'PUT',
    CURLOPT_HTTPHEADER => ['api-key: ' . getenv('BITO_API_KEY'), 'Content-Type: application/json'],
    CURLOPT_POSTFIELDS => $body,
    CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);
```

:::

**Тело запроса**

| Поле | Тип | Обязательно | Описание |
|---|---|---|---|
| `is_enabled` | `boolean` | Да | По умолчанию: `true` |
| `_id` | `string` | Да |  |

```json
{
  "is_enabled": true,
  "_id": "67b486d242ed76693cd2cc59"
}
```

**Ответ**

Структура ответа совпадает с [POST /payment-method/create](#post-payment-method-create).

---

*Эта страница сгенерирована из спецификации OpenAPI.*
