# Payment type

::: info
Har bir javob umumiy konvertda qaytadi — `code`, `message`, `messages`, `status_code`, `time` — foydali yuk esa `data` ichida. Quyidagi jadvallar faqat `data` ichini tavsiflaydi.
:::

## POST /payment-type/create

This method allows adding payment-type into the account.

**Kerakli ruxsat:** `payment_methods` · [ruxsatlar qanday ishlaydi](https://docs.bito.uz/api/permissions.md)

**So‘rov namunasi**

::: code-group

```bash [curl]
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/payment-type/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-type/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-type/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-type/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);
```

:::

**So‘rov tanasi**

| Maydon | Tur | Majburiy | Tavsif |
|---|---|---|---|
| `name` | `string` | Ha |  |
| `parent_id` | `string` | Yo‘q |  |
| `transaction_type` | `string` | Yo‘q | Mumkin qiymatlar: `income`, `expense`, `transfer`, `exchange`, `nothing`, `exchange_method`. Standart: `"income"` |
| `user_type` | `string` | Yo‘q | Mumkin qiymatlar: `supplier`, `employee`, `customer`, `person`, `other`. Standart: `"supplier"` |
| `can_be_canceled` | `boolean` | Yo‘q | Standart: `false` |

```json
{
  "name": "string",
  "parent_id": "67b486d242ed76693cd2cc59",
  "transaction_type": "income",
  "user_type": "supplier",
  "can_be_canceled": false
}
```

**Javob**

| Maydon | Tur | Tavsif |
|---|---|---|
| `_id` | `string` |  |
| `name` | `string` |  |
| `short_cut` | `string` |  |
| `type` | `string` | Mumkin qiymatlar: `cash`, `card`, `debt`, `gift`, `transfer`, `terminal`, `by_balance`, `by_cashback` |
| `is_enabled` | `boolean` | Standart: `true` |
| `is_default` | `boolean` | Standart: `false` |
| `is_visible` | `boolean` | Standart: `false` |
| `created_at` | `string (date-time)` |  |
| `updated_at` | `string (date-time)` |  |

```json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "_id": "string",
    "name": "string",
    "short_cut": "string",
    "type": "cash",
    "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-type/update

This method allows updating payment-type in the account.

**Kerakli ruxsat:** `payment_methods` · [ruxsatlar qanday ishlaydi](https://docs.bito.uz/api/permissions.md)

**So‘rov namunasi**

::: code-group

```bash [curl]
curl -X PUT 'https://api.bito.uz/integration-api/integration/api/v2/payment-type/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-type/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-type/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-type/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);
```

:::

**So‘rov tanasi**

| Maydon | Tur | Majburiy | Tavsif |
|---|---|---|---|
| `_id` | `string` | Ha |  |
| `name` | `string` | Ha |  |
| `parent_id` | `string` | Yo‘q |  |
| `can_be_canceled` | `boolean` | Yo‘q | Standart: `false` |

```json
{
  "_id": "67b486d242ed76693cd2cc59",
  "name": "string",
  "parent_id": "67b486d242ed76693cd2cc59",
  "can_be_canceled": false
}
```

**Javob**

Javob tuzilishi quyidagi bilan bir xil: [POST /payment-type/create](#post-payment-type-create).

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

Delete a payment-type

**Kerakli ruxsat:** `payment_methods` · [ruxsatlar qanday ishlaydi](https://docs.bito.uz/api/permissions.md)

**So‘rov namunasi**

::: code-group

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

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/payment-type/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-type/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-type/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);
```

:::

**Yo‘l parametrlari**

| Parametr | Tur | Majburiy | Tavsif |
|---|---|---|---|
| `id` | `string` | Ha |  |

**So‘rov tanasi**

So‘rov tanasi talab qilinmaydi.

**Javob**

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

## POST /payment-type/get-all

Get all payment-types

**Kerakli ruxsat:** `payment_methods` · [ruxsatlar qanday ishlaydi](https://docs.bito.uz/api/permissions.md)

**So‘rov namunasi**

::: code-group

```bash [curl]
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/payment-type/get-all' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "transaction_type": "income",
  "user_type": "supplier",
  "is_visible": false,
  "is_active": true
}'
```

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/payment-type/get-all', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "transaction_type": "income",
    "user_type": "supplier",
    "is_visible": false,
    "is_active": true
  }),
})
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-type/get-all",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "transaction_type": "income",
        "user_type": "supplier",
        "is_visible": False,
        "is_active": True,
    },
)
print(res.json())
```

```php [PHP]
<?php
$body = <<<'JSON'
{
  "transaction_type": "income",
  "user_type": "supplier",
  "is_visible": false,
  "is_active": true
}
JSON;

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/payment-type/get-all');
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);
```

:::

**So‘rov tanasi**

| Maydon | Tur | Majburiy | Tavsif |
|---|---|---|---|
| `transaction_type` | `string` | Yo‘q | Mumkin qiymatlar: `income`, `expense`, `transfer`, `exchange`, `nothing`, `exchange_method` |
| `user_type` | `string` | Yo‘q | Mumkin qiymatlar: `supplier`, `employee`, `customer`, `person`, `other` |
| `is_visible` | `boolean` | Yo‘q | Standart: `false` |
| `is_active` | `boolean` | Yo‘q | Standart: `true` |

```json
{
  "transaction_type": "income",
  "user_type": "supplier",
  "is_visible": false,
  "is_active": true
}
```

**Javob**

```json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": [
    {
      "_id": "string",
      "name": "string",
      "short_cut": "string",
      "type": "cash",
      "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-type/get-by-id/{id}

Get payment-type using its _id

**Kerakli ruxsat:** `payment_methods` · [ruxsatlar qanday ishlaydi](https://docs.bito.uz/api/permissions.md)

**So‘rov namunasi**

::: code-group

```bash [curl]
curl -X GET 'https://api.bito.uz/integration-api/integration/api/v2/payment-type/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-type/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-type/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-type/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);
```

:::

**Yo‘l parametrlari**

| Parametr | Tur | Majburiy | Tavsif |
|---|---|---|---|
| `id` | `string` | Ha |  |

**So‘rov tanasi**

So‘rov tanasi talab qilinmaydi.

**Javob**

Javob tuzilishi quyidagi bilan bir xil: [POST /payment-type/create](#post-payment-type-create).

## GET /payment-type/get-deleted

Get deleted payment-type ids

**Kerakli ruxsat:** `payment_methods` · [ruxsatlar qanday ishlaydi](https://docs.bito.uz/api/permissions.md)

**So‘rov namunasi**

::: code-group

```bash [curl]
curl -X GET 'https://api.bito.uz/integration-api/integration/api/v2/payment-type/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-type/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-type/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-type/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);
```

:::

**So‘rov parametrlari**

| Parametr | Tur | Majburiy | Tavsif |
|---|---|---|---|
| `deleted_at` | `string` | Ha |  |

**So‘rov tanasi**

So‘rov tanasi talab qilinmaydi.

**Javob**

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

## PUT /payment-type/set-state

This method allows setActive payment-type in the account.

**Kerakli ruxsat:** `payment_methods` · [ruxsatlar qanday ishlaydi](https://docs.bito.uz/api/permissions.md)

**So‘rov namunasi**

::: code-group

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

```js [JavaScript]
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/payment-type/set-state', {
  method: 'PUT',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "_id": "67b486d242ed76693cd2cc59",
    "is_active": 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-type/set-state",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "_id": "67b486d242ed76693cd2cc59",
        "is_active": True,
    },
)
print(res.json())
```

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

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/payment-type/set-state');
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);
```

:::

**So‘rov tanasi**

| Maydon | Tur | Majburiy | Tavsif |
|---|---|---|---|
| `is_active` | `boolean` | Ha | Standart: `true` |
| `_id` | `string` | Ha |  |

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

**Javob**

Javob tuzilishi quyidagi bilan bir xil: [POST /payment-type/create](#post-payment-type-create).

---

*Bu sahifa OpenAPI spetsifikatsiyasidan yaratilgan.*
