# События вебхуков

> Источник: `internal/rules` (список событий и поля), структуры данных в `internal/payments`, `internal/catalog`, `internal/subscriptions`, `internal/approvals`, `internal/crm`, `internal/webhooks` (заголовки, подпись, повторы).

Как принять вебхук и проверить подпись: [Вебхуки](https://paybot.kz/docs/webhooks.md). Здесь только состав событий.

## Конверт

Каждая доставка — `POST` с телом JSON. `data` зависит от типа события (ниже). Суммы в `data` — целые тиыны.

```json
{
  "created_at": "2026-11-23T10:18:00Z",
  "data": {
    "...": "см. событие"
  },
  "id": "evt_018f9a2c7c4d7f1a9b3c4d5e6f708192",
  "mode": "live",
  "type": "payment.success"
}
```

| Поле | Описание |
| --- | --- |
| `id` | Идентификатор события `evt_...`. Повтор доставки несёт тот же `id`. |
| `type` | Тип события. |
| `mode` | `live` или `test`. Тестовые ключи и тестовые платежи дают `mode: test`. |
| `created_at` | Когда событие записано, RFC 3339, UTC. |
| `data` | Данные события. |

## Заголовки

| Заголовок | Значение |
| --- | --- |
| `PayBot-Event-Id` | `evt_...`, тот же `id`, что в теле. Дедуплицируйте по нему. |
| `PayBot-Event-Type` | Тип события. |
| `PayBot-Timestamp` | Unix-секунды, когда подписана **эта попытка**. Входит в подпись. |
| `PayBot-Signature` | `v1=<hex HMAC-SHA256>`. Как проверить: [Вебхуки](https://paybot.kz/docs/webhooks.md#signature). |

## Список событий

Это события с описанным составом `data`: на них можно подписать правила автоматизации. Endpoint без фильтра по типам получает все события журнала, в том числе те, которых нет в таблице: не падайте на неизвестном типе, отвечайте `2xx`.

| Тип | Когда приходит |
| --- | --- |
| [`payment.success`](#payment-success) | Платёж оплачен. |
| [`payment.failed`](#payment-failed) | Платёж не прошёл или отклонён. |
| [`payment.expired`](#payment-expired) | Время платежа вышло, оплаты нет. |
| [`payment.refunded`](#payment-refunded) | Оплаченный платёж возвращён. |
| [`session.expired`](#session-expired) | Сессия кассира Kaspi закончилась: кассиру нужно войти заново. |
| [`approval.requested`](#approval-requested) | Действие ждёт решения человека. |
| [`approval.decided`](#approval-decided) | Запрос подтверждён, отклонён или истёк. |
| [`subscription.activated`](#subscription-activated) | Начался первый период подписчика (оплаченный или пробный). |
| [`subscription.renewed`](#subscription-renewed) | Подписка получила следующий период. |
| [`subscription.expiring`](#subscription-expiring) | Период скоро закончится (сработало напоминание). |
| [`subscription.ended`](#subscription-ended) | Подписка закончилась: доступ нужно закрыть. |
| [`order.created`](#order-created) | Покупатель оформил заказ, оплата ещё не получена. |
| [`order.paid`](#order-paid) | Заказ оплачен. |
| [`order.shipped`](#order-shipped) | Заказ отправлен. |
| [`order.refunded`](#order-refunded) | Оплата заказа возвращена полностью (статус заказа не меняется). |
| [`order.paid_after_cancel`](#order-paid-after-cancel) | Оплата пришла на уже отменённый заказ: деньги нужно вернуть покупателю. |
| [`order.status_changed`](#order-status-changed) | Заказ перешёл в статус packed, done или cancelled. |
| [`bitrix.deal_stage_changed`](#bitrix-deal-stage-changed) | Сделка в Битрикс24 перешла на другую стадию (сообщил обратный адрес интеграции, см. руководство по Битрикс24). |
| [`lead.created`](#lead-created) | Посетитель сайта оставил заявку. |
| `webhook.test` | Пробная доставка кнопкой «Проверить» или `POST /v1/webhooks/{id}/test`. Одна попытка, без повторов. |

### payment.success

Платёж оплачен.

Поля, по которым можно строить условия правил (ключи `data`):

| Поле | Тип | Описание |
| --- | --- | --- |
| `amount` | money | Amount in tiyn (integer; 100 tiyn = 1 tenge). |
| `status` | string | Payment status: paid, failed, expired or refunded. |
| `kind` | string | Payment method: qr or invoice. |
| `mode` | string | live or test. |
| `currency` | string | Currency code (KZT). |
| `description` | string | The payment description as the merchant set it (compared literally). |
| `client_ref` | string | The merchant's own reference for the payment. |
| `failure_reason` | string | Why the payment failed, when it did. |
| `kaspi_operation_id` | int | Kaspi's operation id. |
| `metadata.<key>` | scalar | A key of the payment metadata: metadata.<key>. |

Пример тела (значения придуманы, состав полей взят из структуры):

```json
{
  "created_at": "2026-11-23T10:18:00Z",
  "data": {
    "id": "pay_018f9a2c7c4d7f1a9b3c4d5e6f708192",
    "object": "payment",
    "status": "paid",
    "kind": "qr",
    "mode": "live",
    "amount": 1500000,
    "currency": "KZT",
    "description": "Заказ 1042",
    "client_ref": "order-1042",
    "metadata": {
      "order": "1042"
    },
    "kaspi_operation_id": 7201234567,
    "created_at": "2026-11-23T10:15:00Z",
    "expires_at": "2026-11-23T10:19:05Z",
    "paid_at": "2026-11-23T10:18:00Z",
    "occurred_at": "2026-11-23T10:18:00Z"
  },
  "id": "evt_018f9a2c7c4d7f1a9b3c4d5e6f708192",
  "mode": "live",
  "type": "payment.success"
}
```

### payment.failed

Платёж не прошёл или отклонён.

Поля, по которым можно строить условия правил (ключи `data`):

| Поле | Тип | Описание |
| --- | --- | --- |
| `amount` | money | Amount in tiyn (integer; 100 tiyn = 1 tenge). |
| `status` | string | Payment status: paid, failed, expired or refunded. |
| `kind` | string | Payment method: qr or invoice. |
| `mode` | string | live or test. |
| `currency` | string | Currency code (KZT). |
| `description` | string | The payment description as the merchant set it (compared literally). |
| `client_ref` | string | The merchant's own reference for the payment. |
| `failure_reason` | string | Why the payment failed, when it did. |
| `kaspi_operation_id` | int | Kaspi's operation id. |
| `metadata.<key>` | scalar | A key of the payment metadata: metadata.<key>. |

Пример тела (значения придуманы, состав полей взят из структуры):

```json
{
  "created_at": "2026-11-23T10:18:00Z",
  "data": {
    "id": "pay_018f9a2c7c4d7f1a9b3c4d5e6f708192",
    "object": "payment",
    "status": "failed",
    "kind": "qr",
    "mode": "live",
    "amount": 1500000,
    "currency": "KZT",
    "description": "Заказ 1042",
    "client_ref": "order-1042",
    "metadata": {
      "order": "1042"
    },
    "failure_reason": "cancelled_by_user",
    "created_at": "2026-11-23T10:15:00Z",
    "expires_at": "2026-11-23T10:19:05Z",
    "occurred_at": "2026-11-23T10:18:00Z"
  },
  "id": "evt_018f9a2c7c4d7f1a9b3c4d5e6f708192",
  "mode": "live",
  "type": "payment.failed"
}
```

### payment.expired

Время платежа вышло, оплаты нет.

Поля, по которым можно строить условия правил (ключи `data`):

| Поле | Тип | Описание |
| --- | --- | --- |
| `amount` | money | Amount in tiyn (integer; 100 tiyn = 1 tenge). |
| `status` | string | Payment status: paid, failed, expired or refunded. |
| `kind` | string | Payment method: qr or invoice. |
| `mode` | string | live or test. |
| `currency` | string | Currency code (KZT). |
| `description` | string | The payment description as the merchant set it (compared literally). |
| `client_ref` | string | The merchant's own reference for the payment. |
| `failure_reason` | string | Why the payment failed, when it did. |
| `kaspi_operation_id` | int | Kaspi's operation id. |
| `metadata.<key>` | scalar | A key of the payment metadata: metadata.<key>. |

Пример тела (значения придуманы, состав полей взят из структуры):

```json
{
  "created_at": "2026-11-23T10:18:00Z",
  "data": {
    "id": "pay_018f9a2c7c4d7f1a9b3c4d5e6f708192",
    "object": "payment",
    "status": "expired",
    "kind": "qr",
    "mode": "live",
    "amount": 1500000,
    "currency": "KZT",
    "description": "Заказ 1042",
    "client_ref": "order-1042",
    "metadata": {
      "order": "1042"
    },
    "created_at": "2026-11-23T10:15:00Z",
    "expires_at": "2026-11-23T10:19:05Z",
    "occurred_at": "2026-11-23T10:18:00Z"
  },
  "id": "evt_018f9a2c7c4d7f1a9b3c4d5e6f708192",
  "mode": "live",
  "type": "payment.expired"
}
```

### payment.refunded

Оплаченный платёж возвращён.

Поля, по которым можно строить условия правил (ключи `data`):

| Поле | Тип | Описание |
| --- | --- | --- |
| `amount` | money | Amount in tiyn (integer; 100 tiyn = 1 tenge). |
| `status` | string | Payment status: paid, failed, expired or refunded. |
| `kind` | string | Payment method: qr or invoice. |
| `mode` | string | live or test. |
| `currency` | string | Currency code (KZT). |
| `description` | string | The payment description as the merchant set it (compared literally). |
| `client_ref` | string | The merchant's own reference for the payment. |
| `failure_reason` | string | Why the payment failed, when it did. |
| `kaspi_operation_id` | int | Kaspi's operation id. |
| `metadata.<key>` | scalar | A key of the payment metadata: metadata.<key>. |

Пример тела (значения придуманы, состав полей взят из структуры):

```json
{
  "created_at": "2026-11-23T10:18:00Z",
  "data": {
    "id": "pay_018f9a2c7c4d7f1a9b3c4d5e6f708192",
    "object": "payment",
    "status": "refunded",
    "kind": "qr",
    "mode": "live",
    "amount": 1500000,
    "refunded_amount": 1500000,
    "currency": "KZT",
    "description": "Заказ 1042",
    "client_ref": "order-1042",
    "metadata": {
      "order": "1042"
    },
    "kaspi_operation_id": 7201234567,
    "created_at": "2026-11-23T10:15:00Z",
    "expires_at": "2026-11-23T10:19:05Z",
    "paid_at": "2026-11-23T10:18:00Z",
    "occurred_at": "2026-11-23T10:18:00Z"
  },
  "id": "evt_018f9a2c7c4d7f1a9b3c4d5e6f708192",
  "mode": "live",
  "type": "payment.refunded"
}
```

### session.expired

Сессия кассира Kaspi закончилась: кассиру нужно войти заново.

Поля, по которым можно строить условия правил (ключи `data`):

| Поле | Тип | Описание |
| --- | --- | --- |
| `account_id` | string | The Kaspi account whose session ended. |
| `reason` | string | Why the session ended. |

Пример тела не приводится: структура этого события не публична в коде, состав полей смотрите в таблице.

### approval.requested

Действие ждёт решения человека.

Поля, по которым можно строить условия правил (ключи `data`):

| Поле | Тип | Описание |
| --- | --- | --- |
| `action` | string | What is to be approved, e.g. payment.refund. |
| `status` | string | pending, approved, rejected, expired, executed or failed. |
| `mode` | string | live or test. |
| `amount` | money | The amount at stake, in tiyn. |

Пример тела (значения придуманы, состав полей взят из структуры):

```json
{
  "created_at": "2026-11-23T10:18:00Z",
  "data": {
    "id": "apr_018f9a2c7c4d7f1a9b3c4d5e6f708192",
    "object": "approval",
    "action": "payment.refund",
    "status": "pending",
    "mode": "live",
    "amount": 1500000,
    "params": {
      "payment_id": "pay_018f9a2c7c4d7f1a9b3c4d5e6f708192"
    },
    "requested_by": "user",
    "approve_url": "https://paybot.kz/app/approvals/apr_018f9a2c7c4d7f1a9b3c4d5e6f708192",
    "expires_at": "2026-11-24T10:15:00Z",
    "occurred_at": "2026-11-23T10:15:00Z"
  },
  "id": "evt_018f9a2c7c4d7f1a9b3c4d5e6f708192",
  "mode": "live",
  "type": "approval.requested"
}
```

### approval.decided

Запрос подтверждён, отклонён или истёк.

Поля, по которым можно строить условия правил (ключи `data`):

| Поле | Тип | Описание |
| --- | --- | --- |
| `action` | string | What is to be approved, e.g. payment.refund. |
| `status` | string | pending, approved, rejected, expired, executed or failed. |
| `mode` | string | live or test. |
| `amount` | money | The amount at stake, in tiyn. |

Пример тела (значения придуманы, состав полей взят из структуры):

```json
{
  "created_at": "2026-11-23T10:18:00Z",
  "data": {
    "id": "apr_018f9a2c7c4d7f1a9b3c4d5e6f708192",
    "object": "approval",
    "action": "payment.refund",
    "status": "approved",
    "mode": "live",
    "amount": 1500000,
    "params": {
      "payment_id": "pay_018f9a2c7c4d7f1a9b3c4d5e6f708192"
    },
    "requested_by": "user",
    "decided_by": "user",
    "expires_at": "2026-11-24T10:15:00Z",
    "decided_at": "2026-11-23T10:18:00Z",
    "occurred_at": "2026-11-23T10:15:00Z"
  },
  "id": "evt_018f9a2c7c4d7f1a9b3c4d5e6f708192",
  "mode": "live",
  "type": "approval.decided"
}
```

### subscription.activated

Начался первый период подписчика (оплаченный или пробный).

Поля, по которым можно строить условия правил (ключи `data`):

| Поле | Тип | Описание |
| --- | --- | --- |
| `plan_id` | string | The plan (pln_...). |
| `subscription_id` | string | The subscription (sub_...). |
| `subscriber_id` | string | The subscriber (sbr_...). |

Пример тела (значения придуманы, состав полей взят из структуры):

```json
{
  "created_at": "2026-11-23T10:18:00Z",
  "data": {
    "subscription_id": "sub_018f9a2c7c4d7f1a9b3c4d5e6f708192",
    "plan_id": "pln_018f9a2c7c4d7f1a9b3c4d5e6f708192",
    "subscriber_id": "sbr_018f9a2c7c4d7f1a9b3c4d5e6f708192",
    "period_start": "2026-11-23T10:15:00Z",
    "period_end": "2026-12-23T10:15:00Z",
    "payment_id": "pay_018f9a2c7c4d7f1a9b3c4d5e6f708192"
  },
  "id": "evt_018f9a2c7c4d7f1a9b3c4d5e6f708192",
  "mode": "live",
  "type": "subscription.activated"
}
```

### subscription.renewed

Подписка получила следующий период.

Поля, по которым можно строить условия правил (ключи `data`):

| Поле | Тип | Описание |
| --- | --- | --- |
| `plan_id` | string | The plan (pln_...). |
| `subscription_id` | string | The subscription (sub_...). |
| `subscriber_id` | string | The subscriber (sbr_...). |

Пример тела (значения придуманы, состав полей взят из структуры):

```json
{
  "created_at": "2026-11-23T10:18:00Z",
  "data": {
    "subscription_id": "sub_018f9a2c7c4d7f1a9b3c4d5e6f708192",
    "plan_id": "pln_018f9a2c7c4d7f1a9b3c4d5e6f708192",
    "subscriber_id": "sbr_018f9a2c7c4d7f1a9b3c4d5e6f708192",
    "period_start": "2026-11-23T10:15:00Z",
    "period_end": "2026-12-23T10:15:00Z",
    "payment_id": "pay_018f9a2c7c4d7f1a9b3c4d5e6f708192"
  },
  "id": "evt_018f9a2c7c4d7f1a9b3c4d5e6f708192",
  "mode": "live",
  "type": "subscription.renewed"
}
```

### subscription.expiring

Период скоро закончится (сработало напоминание).

Поля, по которым можно строить условия правил (ключи `data`):

| Поле | Тип | Описание |
| --- | --- | --- |
| `plan_id` | string | The plan (pln_...). |
| `subscription_id` | string | The subscription (sub_...). |
| `subscriber_id` | string | The subscriber (sbr_...). |
| `days_left` | int | Whole days until the period ends, rounded up. |

Пример тела (значения придуманы, состав полей взят из структуры):

```json
{
  "created_at": "2026-11-23T10:18:00Z",
  "data": {
    "subscription_id": "sub_018f9a2c7c4d7f1a9b3c4d5e6f708192",
    "plan_id": "pln_018f9a2c7c4d7f1a9b3c4d5e6f708192",
    "subscriber_id": "sbr_018f9a2c7c4d7f1a9b3c4d5e6f708192",
    "period_end": "2026-11-26T10:15:00Z",
    "days_left": 3
  },
  "id": "evt_018f9a2c7c4d7f1a9b3c4d5e6f708192",
  "mode": "live",
  "type": "subscription.expiring"
}
```

### subscription.ended

Подписка закончилась: доступ нужно закрыть.

Поля, по которым можно строить условия правил (ключи `data`):

| Поле | Тип | Описание |
| --- | --- | --- |
| `plan_id` | string | The plan (pln_...). |
| `subscription_id` | string | The subscription (sub_...). |
| `subscriber_id` | string | The subscriber (sbr_...). |
| `reason` | string | expired or cancelled. |

Пример тела (значения придуманы, состав полей взят из структуры):

```json
{
  "created_at": "2026-11-23T10:18:00Z",
  "data": {
    "subscription_id": "sub_018f9a2c7c4d7f1a9b3c4d5e6f708192",
    "plan_id": "pln_018f9a2c7c4d7f1a9b3c4d5e6f708192",
    "subscriber_id": "sbr_018f9a2c7c4d7f1a9b3c4d5e6f708192",
    "ended_at": "2026-11-23T10:15:00Z",
    "reason": "expired"
  },
  "id": "evt_018f9a2c7c4d7f1a9b3c4d5e6f708192",
  "mode": "live",
  "type": "subscription.ended"
}
```

### order.created

Покупатель оформил заказ, оплата ещё не получена.

Поля, по которым можно строить условия правил (ключи `data`):

| Поле | Тип | Описание |
| --- | --- | --- |
| `status` | string | Order status: new, paid, packed, shipped, done or cancelled. |
| `previous_status` | string | The status before this change. |
| `reason` | string | Why the order changed, e.g. payment_expired. |
| `mode` | string | live or test. |
| `source` | string | What placed the order, e.g. store. |
| `currency` | string | Currency code (KZT). |
| `subtotal` | money | Goods, in tiyn. |
| `delivery_price` | money | Delivery, in tiyn. |
| `total` | money | What the buyer pays, in tiyn. |
| `delivery_code` | string | The delivery option code. |
| `delivery_kind` | string | pickup, courier, courier_free_over or arrangement. |
| `item_count` | int | Units in the order. |
| `refunded` | scalar | true once the order's payment was refunded in full. |

Пример тела (значения придуманы, состав полей взят из структуры):

```json
{
  "created_at": "2026-11-23T10:18:00Z",
  "data": {
    "id": "ord_018f9a2c7c4d7f1a9b3c4d5e6f708192",
    "object": "order",
    "status": "new",
    "mode": "live",
    "source": "store",
    "currency": "KZT",
    "subtotal": 1200000,
    "delivery_price": 300000,
    "total": 1500000,
    "delivery_code": "courier",
    "delivery_kind": "courier",
    "item_count": 2,
    "items": [
      {
        "sku": "green-tea-100g",
        "quantity": 2,
        "unit_price": 600000
      }
    ],
    "payment_id": "pay_018f9a2c7c4d7f1a9b3c4d5e6f708192",
    "refunded": false,
    "created_at": "2026-11-23T10:15:00Z",
    "occurred_at": "2026-11-23T10:18:00Z"
  },
  "id": "evt_018f9a2c7c4d7f1a9b3c4d5e6f708192",
  "mode": "live",
  "type": "order.created"
}
```

### order.paid

Заказ оплачен.

Поля, по которым можно строить условия правил (ключи `data`):

| Поле | Тип | Описание |
| --- | --- | --- |
| `status` | string | Order status: new, paid, packed, shipped, done or cancelled. |
| `previous_status` | string | The status before this change. |
| `reason` | string | Why the order changed, e.g. payment_expired. |
| `mode` | string | live or test. |
| `source` | string | What placed the order, e.g. store. |
| `currency` | string | Currency code (KZT). |
| `subtotal` | money | Goods, in tiyn. |
| `delivery_price` | money | Delivery, in tiyn. |
| `total` | money | What the buyer pays, in tiyn. |
| `delivery_code` | string | The delivery option code. |
| `delivery_kind` | string | pickup, courier, courier_free_over or arrangement. |
| `item_count` | int | Units in the order. |
| `refunded` | scalar | true once the order's payment was refunded in full. |

Пример тела (значения придуманы, состав полей взят из структуры):

```json
{
  "created_at": "2026-11-23T10:18:00Z",
  "data": {
    "id": "ord_018f9a2c7c4d7f1a9b3c4d5e6f708192",
    "object": "order",
    "status": "paid",
    "previous_status": "new",
    "mode": "live",
    "source": "store",
    "currency": "KZT",
    "subtotal": 1200000,
    "delivery_price": 300000,
    "total": 1500000,
    "delivery_code": "courier",
    "delivery_kind": "courier",
    "item_count": 2,
    "items": [
      {
        "sku": "green-tea-100g",
        "quantity": 2,
        "unit_price": 600000
      }
    ],
    "payment_id": "pay_018f9a2c7c4d7f1a9b3c4d5e6f708192",
    "refunded": false,
    "created_at": "2026-11-23T10:15:00Z",
    "occurred_at": "2026-11-23T10:18:00Z"
  },
  "id": "evt_018f9a2c7c4d7f1a9b3c4d5e6f708192",
  "mode": "live",
  "type": "order.paid"
}
```

### order.shipped

Заказ отправлен.

Поля, по которым можно строить условия правил (ключи `data`):

| Поле | Тип | Описание |
| --- | --- | --- |
| `status` | string | Order status: new, paid, packed, shipped, done or cancelled. |
| `previous_status` | string | The status before this change. |
| `reason` | string | Why the order changed, e.g. payment_expired. |
| `mode` | string | live or test. |
| `source` | string | What placed the order, e.g. store. |
| `currency` | string | Currency code (KZT). |
| `subtotal` | money | Goods, in tiyn. |
| `delivery_price` | money | Delivery, in tiyn. |
| `total` | money | What the buyer pays, in tiyn. |
| `delivery_code` | string | The delivery option code. |
| `delivery_kind` | string | pickup, courier, courier_free_over or arrangement. |
| `item_count` | int | Units in the order. |
| `refunded` | scalar | true once the order's payment was refunded in full. |

Пример тела (значения придуманы, состав полей взят из структуры):

```json
{
  "created_at": "2026-11-23T10:18:00Z",
  "data": {
    "id": "ord_018f9a2c7c4d7f1a9b3c4d5e6f708192",
    "object": "order",
    "status": "shipped",
    "previous_status": "paid",
    "mode": "live",
    "source": "store",
    "currency": "KZT",
    "subtotal": 1200000,
    "delivery_price": 300000,
    "total": 1500000,
    "delivery_code": "courier",
    "delivery_kind": "courier",
    "item_count": 2,
    "items": [
      {
        "sku": "green-tea-100g",
        "quantity": 2,
        "unit_price": 600000
      }
    ],
    "payment_id": "pay_018f9a2c7c4d7f1a9b3c4d5e6f708192",
    "refunded": false,
    "created_at": "2026-11-23T10:15:00Z",
    "occurred_at": "2026-11-23T10:18:00Z"
  },
  "id": "evt_018f9a2c7c4d7f1a9b3c4d5e6f708192",
  "mode": "live",
  "type": "order.shipped"
}
```

### order.refunded

Оплата заказа возвращена полностью (статус заказа не меняется).

Поля, по которым можно строить условия правил (ключи `data`):

| Поле | Тип | Описание |
| --- | --- | --- |
| `status` | string | Order status: new, paid, packed, shipped, done or cancelled. |
| `previous_status` | string | The status before this change. |
| `reason` | string | Why the order changed, e.g. payment_expired. |
| `mode` | string | live or test. |
| `source` | string | What placed the order, e.g. store. |
| `currency` | string | Currency code (KZT). |
| `subtotal` | money | Goods, in tiyn. |
| `delivery_price` | money | Delivery, in tiyn. |
| `total` | money | What the buyer pays, in tiyn. |
| `delivery_code` | string | The delivery option code. |
| `delivery_kind` | string | pickup, courier, courier_free_over or arrangement. |
| `item_count` | int | Units in the order. |
| `refunded` | scalar | true once the order's payment was refunded in full. |

Пример тела (значения придуманы, состав полей взят из структуры):

```json
{
  "created_at": "2026-11-23T10:18:00Z",
  "data": {
    "id": "ord_018f9a2c7c4d7f1a9b3c4d5e6f708192",
    "object": "order",
    "status": "paid",
    "mode": "live",
    "source": "store",
    "currency": "KZT",
    "subtotal": 1200000,
    "delivery_price": 300000,
    "total": 1500000,
    "delivery_code": "courier",
    "delivery_kind": "courier",
    "item_count": 2,
    "items": [
      {
        "sku": "green-tea-100g",
        "quantity": 2,
        "unit_price": 600000
      }
    ],
    "payment_id": "pay_018f9a2c7c4d7f1a9b3c4d5e6f708192",
    "refunded": true,
    "created_at": "2026-11-23T10:15:00Z",
    "occurred_at": "2026-11-23T10:18:00Z"
  },
  "id": "evt_018f9a2c7c4d7f1a9b3c4d5e6f708192",
  "mode": "live",
  "type": "order.refunded"
}
```

### order.paid_after_cancel

Оплата пришла на уже отменённый заказ: деньги нужно вернуть покупателю.

Поля, по которым можно строить условия правил (ключи `data`):

| Поле | Тип | Описание |
| --- | --- | --- |
| `status` | string | Order status: new, paid, packed, shipped, done or cancelled. |
| `previous_status` | string | The status before this change. |
| `reason` | string | Why the order changed, e.g. payment_expired. |
| `mode` | string | live or test. |
| `source` | string | What placed the order, e.g. store. |
| `currency` | string | Currency code (KZT). |
| `subtotal` | money | Goods, in tiyn. |
| `delivery_price` | money | Delivery, in tiyn. |
| `total` | money | What the buyer pays, in tiyn. |
| `delivery_code` | string | The delivery option code. |
| `delivery_kind` | string | pickup, courier, courier_free_over or arrangement. |
| `item_count` | int | Units in the order. |
| `refunded` | scalar | true once the order's payment was refunded in full. |

Пример тела (значения придуманы, состав полей взят из структуры):

```json
{
  "created_at": "2026-11-23T10:18:00Z",
  "data": {
    "id": "ord_018f9a2c7c4d7f1a9b3c4d5e6f708192",
    "object": "order",
    "status": "cancelled",
    "previous_status": "cancelled",
    "mode": "live",
    "source": "store",
    "currency": "KZT",
    "subtotal": 1200000,
    "delivery_price": 300000,
    "total": 1500000,
    "delivery_code": "courier",
    "delivery_kind": "courier",
    "item_count": 2,
    "items": [
      {
        "sku": "green-tea-100g",
        "quantity": 2,
        "unit_price": 600000
      }
    ],
    "payment_id": "pay_018f9a2c7c4d7f1a9b3c4d5e6f708192",
    "refunded": false,
    "created_at": "2026-11-23T10:15:00Z",
    "occurred_at": "2026-11-23T10:18:00Z"
  },
  "id": "evt_018f9a2c7c4d7f1a9b3c4d5e6f708192",
  "mode": "live",
  "type": "order.paid_after_cancel"
}
```

### order.status_changed

Заказ перешёл в статус packed, done или cancelled.

Поля, по которым можно строить условия правил (ключи `data`):

| Поле | Тип | Описание |
| --- | --- | --- |
| `status` | string | Order status: new, paid, packed, shipped, done or cancelled. |
| `previous_status` | string | The status before this change. |
| `reason` | string | Why the order changed, e.g. payment_expired. |
| `mode` | string | live or test. |
| `source` | string | What placed the order, e.g. store. |
| `currency` | string | Currency code (KZT). |
| `subtotal` | money | Goods, in tiyn. |
| `delivery_price` | money | Delivery, in tiyn. |
| `total` | money | What the buyer pays, in tiyn. |
| `delivery_code` | string | The delivery option code. |
| `delivery_kind` | string | pickup, courier, courier_free_over or arrangement. |
| `item_count` | int | Units in the order. |
| `refunded` | scalar | true once the order's payment was refunded in full. |

Пример тела (значения придуманы, состав полей взят из структуры):

```json
{
  "created_at": "2026-11-23T10:18:00Z",
  "data": {
    "id": "ord_018f9a2c7c4d7f1a9b3c4d5e6f708192",
    "object": "order",
    "status": "done",
    "previous_status": "shipped",
    "mode": "live",
    "source": "store",
    "currency": "KZT",
    "subtotal": 1200000,
    "delivery_price": 300000,
    "total": 1500000,
    "delivery_code": "courier",
    "delivery_kind": "courier",
    "item_count": 2,
    "items": [
      {
        "sku": "green-tea-100g",
        "quantity": 2,
        "unit_price": 600000
      }
    ],
    "payment_id": "pay_018f9a2c7c4d7f1a9b3c4d5e6f708192",
    "refunded": false,
    "created_at": "2026-11-23T10:15:00Z",
    "occurred_at": "2026-11-23T10:18:00Z"
  },
  "id": "evt_018f9a2c7c4d7f1a9b3c4d5e6f708192",
  "mode": "live",
  "type": "order.status_changed"
}
```

### bitrix.deal_stage_changed

Сделка в Битрикс24 перешла на другую стадию (сообщил обратный адрес интеграции, см. руководство по Битрикс24).

Поля, по которым можно строить условия правил (ключи `data`):

| Поле | Тип | Описание |
| --- | --- | --- |
| `deal_id` | int | The Bitrix24 deal id. |
| `stage_id` | string | The deal's new stage, a Bitrix24 STATUS_ID such as C7:WON. |
| `paybot_ref` | string | The PayBot payment or order (pay_..., ord_...) the deal was made for, when known. |
| `contact_id` | string | The PayBot client (cnt_...) of the deal, when known. |
| `subscriber_id` | string | The same client as a subscriber (sbr_...), so actions that message a subscriber work. |

Пример тела (значения придуманы, состав полей взят из структуры):

```json
{
  "created_at": "2026-11-23T10:18:00Z",
  "data": {
    "deal_id": 1234,
    "stage_id": "C7:WON",
    "paybot_ref": "pay_018f9a2c7c4d7f1a9b3c4d5e6f708192",
    "contact_id": "cnt_018f9a2c7c4d7f1a9b3c4d5e6f708192",
    "subscriber_id": "sbr_018f9a2c7c4d7f1a9b3c4d5e6f708192"
  },
  "id": "evt_018f9a2c7c4d7f1a9b3c4d5e6f708192",
  "mode": "live",
  "type": "bitrix.deal_stage_changed"
}
```

### lead.created

Посетитель сайта оставил заявку.

Поля, по которым можно строить условия правил (ключи `data`):

| Поле | Тип | Описание |
| --- | --- | --- |
| `source` | string | Which form of the site sent it, e.g. contact (the merchant's own label). |
| `page_slug` | string | The page the form was posted to. |
| `test` | scalar | true for a request sent from the builder's preview. |

Пример тела (значения придуманы, состав полей взят из структуры):

```json
{
  "created_at": "2026-11-23T10:18:00Z",
  "data": {
    "lead_id": "lead_018f9a2c7c4d7f1a9b3c4d5e6f708192",
    "contact_id": "cnt_018f9a2c7c4d7f1a9b3c4d5e6f708192",
    "source": "contact",
    "page_slug": "home",
    "test": false
  },
  "id": "evt_018f9a2c7c4d7f1a9b3c4d5e6f708192",
  "mode": "live",
  "type": "lead.created"
}
```
