# [YooKassa API SDK](../home.md)
# Abstract Class: \YooKassa\Model\Notification\AbstractNotification
### Namespace: [\YooKassa\Model\Notification](../namespaces/yookassa-model-notification.md)
---
**Summary:**
Базовый класс уведомлений.
---
### Examples
Пример скрипта обработки уведомления
```php
require_once '../vendor/autoload.php';
try {
$source = file_get_contents('php://input');
$data = json_decode($source, true);
$factory = new \YooKassa\Model\Notification\NotificationFactory();
$notificationObject = $factory->factory($data);
$responseObject = $notificationObject->getObject();
$client = new \YooKassa\Client();
if (!$client->isNotificationIPTrusted($_SERVER['REMOTE_ADDR'])) {
header('HTTP/1.1 400 Something went wrong');
exit;
}
if (\YooKassa\Model\Notification\NotificationEventType::PAYMENT_SUCCEEDED === $notificationObject->getEvent()) {
$someData = [
'paymentId' => $responseObject->getId(),
'paymentStatus' => $responseObject->getStatus(),
];
// Специфичная логика
// ...
} elseif (\YooKassa\Model\Notification\NotificationEventType::PAYMENT_WAITING_FOR_CAPTURE === $notificationObject->getEvent()) {
$someData = [
'paymentId' => $responseObject->getId(),
'paymentStatus' => $responseObject->getStatus(),
];
// Специфичная логика
// ...
} elseif (\YooKassa\Model\Notification\NotificationEventType::PAYMENT_CANCELED === $notificationObject->getEvent()) {
$someData = [
'paymentId' => $responseObject->getId(),
'paymentStatus' => $responseObject->getStatus(),
];
// Специфичная логика
// ...
} elseif (\YooKassa\Model\Notification\NotificationEventType::REFUND_SUCCEEDED === $notificationObject->getEvent()) {
$someData = [
'refundId' => $responseObject->getId(),
'refundStatus' => $responseObject->getStatus(),
'paymentId' => $responseObject->getPaymentId(),
];
// ...
// Специфичная логика
} else {
header('HTTP/1.1 400 Something went wrong');
exit;
}
// Специфичная логика
// ...
$client->setAuth('xxxxxx', 'test_XXXXXXX');
// Получим актуальную информацию о платеже
if ($paymentInfo = $client->getPaymentInfo($someData['paymentId'])) {
$paymentStatus = $paymentInfo->getStatus();
// Специфичная логика
// ...
} else {
header('HTTP/1.1 400 Something went wrong');
exit;
}
} catch (Exception $e) {
header('HTTP/1.1 400 Something went wrong');
exit;
}
```
---
### Constants
* No constants found
---
### Properties
| Visibility | Name | Flag | Summary |
| ----------:| ---- | ---- | ------- |
| public | [$event](../classes/YooKassa-Model-Notification-AbstractNotification.md#property_event) | | Тип события |
| public | [$type](../classes/YooKassa-Model-Notification-AbstractNotification.md#property_type) | | Тип уведомления в виде строки |
| protected | [$_event](../classes/YooKassa-Model-Notification-AbstractNotification.md#property__event) | | |
| protected | [$_type](../classes/YooKassa-Model-Notification-AbstractNotification.md#property__type) | | |
---
### Methods
| Visibility | Name | Flag | Summary |
| ----------:| ---- | ---- | ------- |
| public | [__construct()](../classes/YooKassa-Common-AbstractObject.md#method___construct) | | AbstractObject constructor. |
| public | [__get()](../classes/YooKassa-Common-AbstractObject.md#method___get) | | Возвращает значение свойства. |
| public | [__isset()](../classes/YooKassa-Common-AbstractObject.md#method___isset) | | Проверяет наличие свойства. |
| public | [__set()](../classes/YooKassa-Common-AbstractObject.md#method___set) | | Устанавливает значение свойства. |
| public | [__unset()](../classes/YooKassa-Common-AbstractObject.md#method___unset) | | Удаляет свойство. |
| public | [fromArray()](../classes/YooKassa-Common-AbstractObject.md#method_fromArray) | | Устанавливает значения свойств текущего объекта из массива. |
| public | [getEvent()](../classes/YooKassa-Model-Notification-AbstractNotification.md#method_getEvent) | | Возвращает тип события. |
| public | [getObject()](../classes/YooKassa-Model-Notification-AbstractNotification.md#method_getObject) | | Возвращает объект с информацией о платеже или возврате, уведомление о котором хранится в текущем объекте. |
| public | [getType()](../classes/YooKassa-Model-Notification-AbstractNotification.md#method_getType) | | Возвращает тип уведомления. |
| public | [getValidator()](../classes/YooKassa-Common-AbstractObject.md#method_getValidator) | | |
| public | [jsonSerialize()](../classes/YooKassa-Common-AbstractObject.md#method_jsonSerialize) | | Возвращает ассоциативный массив со свойствами текущего объекта для его дальнейшей JSON сериализации. |
| public | [offsetExists()](../classes/YooKassa-Common-AbstractObject.md#method_offsetExists) | | Проверяет наличие свойства. |
| public | [offsetGet()](../classes/YooKassa-Common-AbstractObject.md#method_offsetGet) | | Возвращает значение свойства. |
| public | [offsetSet()](../classes/YooKassa-Common-AbstractObject.md#method_offsetSet) | | Устанавливает значение свойства. |
| public | [offsetUnset()](../classes/YooKassa-Common-AbstractObject.md#method_offsetUnset) | | Удаляет свойство. |
| public | [toArray()](../classes/YooKassa-Common-AbstractObject.md#method_toArray) | | Возвращает ассоциативный массив со свойствами текущего объекта для его дальнейшей JSON сериализации Является алиасом метода AbstractObject::jsonSerialize(). |
| protected | [getUnknownProperties()](../classes/YooKassa-Common-AbstractObject.md#method_getUnknownProperties) | | Возвращает массив свойств которые не существуют, но были заданы у объекта. |
| protected | [setEvent()](../classes/YooKassa-Model-Notification-AbstractNotification.md#method_setEvent) | | Устанавливает тип события. |
| protected | [setType()](../classes/YooKassa-Model-Notification-AbstractNotification.md#method_setType) | | Устанавливает тип уведомления. |
| protected | [validatePropertyValue()](../classes/YooKassa-Common-AbstractObject.md#method_validatePropertyValue) | | |
---
### Details
* File: [lib/Model/Notification/AbstractNotification.php](../../lib/Model/Notification/AbstractNotification.php)
* Package: YooKassa\Model
* Class Hierarchy:
* [\YooKassa\Common\AbstractObject](../classes/YooKassa-Common-AbstractObject.md)
* \YooKassa\Model\Notification\AbstractNotification
* Implements:
* [\YooKassa\Model\Notification\NotificationInterface](../classes/YooKassa-Model-Notification-NotificationInterface.md)
* See Also:
* [](https://yookassa.ru/developers/api)
---
### Tags
| Tag | Version | Description |
| --- | ------- | ----------- |
| category | | Class |
| author | | cms@yoomoney.ru |
---
## Properties
#### public $event : string
---
***Description***
Тип события
**Type:** string
**Details:**
#### public $type : string
---
***Description***
Тип уведомления в виде строки
**Type:** string
**Details:**
#### protected $_event : ?string
---
**Type:** ?string
Тип произошедшего события
**Details:**
#### protected $_type : ?string
---
**Type:** ?string
Тип уведомления
**Details:**
---
## Methods
#### public __construct() : mixed
```php
public __construct(array|null $data = []) : mixed
```
**Summary**
AbstractObject constructor.
**Details:**
* Inherited From: [\YooKassa\Common\AbstractObject](../classes/YooKassa-Common-AbstractObject.md)
##### Parameters:
| Type | Name | Description |
| ---- | ---- | ----------- |
| array OR null | data | |
**Returns:** mixed -
#### public __get() : mixed
```php
public __get(string $propertyName) : mixed
```
**Summary**
Возвращает значение свойства.
**Details:**
* Inherited From: [\YooKassa\Common\AbstractObject](../classes/YooKassa-Common-AbstractObject.md)
##### Parameters:
| Type | Name | Description |
| ---- | ---- | ----------- |
| string | propertyName | Имя свойства |
**Returns:** mixed - Значение свойства
#### public __isset() : bool
```php
public __isset(string $propertyName) : bool
```
**Summary**
Проверяет наличие свойства.
**Details:**
* Inherited From: [\YooKassa\Common\AbstractObject](../classes/YooKassa-Common-AbstractObject.md)
##### Parameters:
| Type | Name | Description |
| ---- | ---- | ----------- |
| string | propertyName | Имя проверяемого свойства |
**Returns:** bool - True если свойство имеется, false если нет
#### public __set() : void
```php
public __set(string $propertyName, mixed $value) : void
```
**Summary**
Устанавливает значение свойства.
**Details:**
* Inherited From: [\YooKassa\Common\AbstractObject](../classes/YooKassa-Common-AbstractObject.md)
##### Parameters:
| Type | Name | Description |
| ---- | ---- | ----------- |
| string | propertyName | Имя свойства |
| mixed | value | Значение свойства |
**Returns:** void -
#### public __unset() : void
```php
public __unset(string $propertyName) : void
```
**Summary**
Удаляет свойство.
**Details:**
* Inherited From: [\YooKassa\Common\AbstractObject](../classes/YooKassa-Common-AbstractObject.md)
##### Parameters:
| Type | Name | Description |
| ---- | ---- | ----------- |
| string | propertyName | Имя удаляемого свойства |
**Returns:** void -
#### public fromArray() : void
```php
public fromArray(array|\Traversable $sourceArray) : void
```
**Summary**
Устанавливает значения свойств текущего объекта из массива.
**Details:**
* Inherited From: [\YooKassa\Common\AbstractObject](../classes/YooKassa-Common-AbstractObject.md)
##### Parameters:
| Type | Name | Description |
| ---- | ---- | ----------- |
| array OR \Traversable | sourceArray | Ассоциативный массив с настройками |
**Returns:** void -
#### public getEvent() : string|null
```php
public getEvent() : string|null
```
**Summary**
Возвращает тип события.
**Description**
Тип события - одна из констант, указанных в перечислении {@link}.
**Details:**
* Inherited From: [\YooKassa\Model\Notification\AbstractNotification](../classes/YooKassa-Model-Notification-AbstractNotification.md)
**Returns:** string|null - Тип события
#### public getObject() : \YooKassa\Model\Payment\PaymentInterface|\YooKassa\Model\Refund\RefundInterface|\YooKassa\Model\Payout\PayoutInterface|\YooKassa\Model\Deal\DealInterface|\YooKassa\Model\SavePaymentMethod\SavePaymentMethodInterface|null
```php
Abstract public getObject() : \YooKassa\Model\Payment\PaymentInterface|\YooKassa\Model\Refund\RefundInterface|\YooKassa\Model\Payout\PayoutInterface|\YooKassa\Model\Deal\DealInterface|\YooKassa\Model\SavePaymentMethod\SavePaymentMethodInterface|null
```
**Summary**
Возвращает объект с информацией о платеже или возврате, уведомление о котором хранится в текущем объекте.
**Description**
Так как нотификация может быть сгенерирована и поставлена в очередь на отправку гораздо раньше, чем она будет
получена на сайте, то опираться на статус пришедшего платежа не стоит, лучше запросить текущую информацию о
платеже у API.
**Details:**
* Inherited From: [\YooKassa\Model\Notification\AbstractNotification](../classes/YooKassa-Model-Notification-AbstractNotification.md)
**Returns:** \YooKassa\Model\Payment\PaymentInterface|\YooKassa\Model\Refund\RefundInterface|\YooKassa\Model\Payout\PayoutInterface|\YooKassa\Model\Deal\DealInterface|\YooKassa\Model\SavePaymentMethod\SavePaymentMethodInterface|null - Объект с информацией о платеже
#### public getType() : string|null
```php
public getType() : string|null
```
**Summary**
Возвращает тип уведомления.
**Description**
Тип уведомления - одна из констант, указанных в перечислении {@link}.
**Details:**
* Inherited From: [\YooKassa\Model\Notification\AbstractNotification](../classes/YooKassa-Model-Notification-AbstractNotification.md)
**Returns:** string|null - Тип уведомления в виде строки
#### public getValidator() : \YooKassa\Validator\Validator
```php
public getValidator() : \YooKassa\Validator\Validator
```
**Details:**
* Inherited From: [\YooKassa\Common\AbstractObject](../classes/YooKassa-Common-AbstractObject.md)
**Returns:** \YooKassa\Validator\Validator -
#### public jsonSerialize() : array
```php
public jsonSerialize() : array
```
**Summary**
Возвращает ассоциативный массив со свойствами текущего объекта для его дальнейшей JSON сериализации.
**Details:**
* Inherited From: [\YooKassa\Common\AbstractObject](../classes/YooKassa-Common-AbstractObject.md)
**Returns:** array - Ассоциативный массив со свойствами текущего объекта
#### public offsetExists() : bool
```php
public offsetExists(string $offset) : bool
```
**Summary**
Проверяет наличие свойства.
**Details:**
* Inherited From: [\YooKassa\Common\AbstractObject](../classes/YooKassa-Common-AbstractObject.md)
##### Parameters:
| Type | Name | Description |
| ---- | ---- | ----------- |
| string | offset | Имя проверяемого свойства |
**Returns:** bool - True если свойство имеется, false если нет
#### public offsetGet() : mixed
```php
public offsetGet(string $offset) : mixed
```
**Summary**
Возвращает значение свойства.
**Details:**
* Inherited From: [\YooKassa\Common\AbstractObject](../classes/YooKassa-Common-AbstractObject.md)
##### Parameters:
| Type | Name | Description |
| ---- | ---- | ----------- |
| string | offset | Имя свойства |
**Returns:** mixed - Значение свойства
#### public offsetSet() : void
```php
public offsetSet(string $offset, mixed $value) : void
```
**Summary**
Устанавливает значение свойства.
**Details:**
* Inherited From: [\YooKassa\Common\AbstractObject](../classes/YooKassa-Common-AbstractObject.md)
##### Parameters:
| Type | Name | Description |
| ---- | ---- | ----------- |
| string | offset | Имя свойства |
| mixed | value | Значение свойства |
**Returns:** void -
#### public offsetUnset() : void
```php
public offsetUnset(string $offset) : void
```
**Summary**
Удаляет свойство.
**Details:**
* Inherited From: [\YooKassa\Common\AbstractObject](../classes/YooKassa-Common-AbstractObject.md)
##### Parameters:
| Type | Name | Description |
| ---- | ---- | ----------- |
| string | offset | Имя удаляемого свойства |
**Returns:** void -
#### public toArray() : array
```php
public toArray() : array
```
**Summary**
Возвращает ассоциативный массив со свойствами текущего объекта для его дальнейшей JSON сериализации
Является алиасом метода AbstractObject::jsonSerialize().
**Details:**
* Inherited From: [\YooKassa\Common\AbstractObject](../classes/YooKassa-Common-AbstractObject.md)
**Returns:** array - Ассоциативный массив со свойствами текущего объекта
#### protected getUnknownProperties() : array
```php
protected getUnknownProperties() : array
```
**Summary**
Возвращает массив свойств которые не существуют, но были заданы у объекта.
**Details:**
* Inherited From: [\YooKassa\Common\AbstractObject](../classes/YooKassa-Common-AbstractObject.md)
**Returns:** array - Ассоциативный массив с не существующими у текущего объекта свойствами
#### protected setEvent() : self
```php
protected setEvent(string|null $event) : self
```
**Summary**
Устанавливает тип события.
**Details:**
* Inherited From: [\YooKassa\Model\Notification\AbstractNotification](../classes/YooKassa-Model-Notification-AbstractNotification.md)
##### Parameters:
| Type | Name | Description |
| ---- | ---- | ----------- |
| string OR null | event | Тип события |
**Returns:** self -
#### protected setType() : self
```php
protected setType(string|null $type) : self
```
**Summary**
Устанавливает тип уведомления.
**Details:**
* Inherited From: [\YooKassa\Model\Notification\AbstractNotification](../classes/YooKassa-Model-Notification-AbstractNotification.md)
##### Parameters:
| Type | Name | Description |
| ---- | ---- | ----------- |
| string OR null | type | Тип уведомления |
**Returns:** self -
#### protected validatePropertyValue() : mixed
```php
protected validatePropertyValue(string $propertyName, mixed $propertyValue) : mixed
```
**Details:**
* Inherited From: [\YooKassa\Common\AbstractObject](../classes/YooKassa-Common-AbstractObject.md)
##### Parameters:
| Type | Name | Description |
| ---- | ---- | ----------- |
| string | propertyName | |
| mixed | propertyValue | |
**Returns:** mixed -
---
### Top Namespaces
* [\YooKassa](../namespaces/yookassa.md)
---
### Reports
* [Errors - 0](../reports/errors.md)
* [Markers - 0](../reports/markers.md)
* [Deprecated - 43](../reports/deprecated.md)
---
This document was automatically generated from source code comments on 2026-06-29 using [phpDocumentor](http://www.phpdoc.org/)
© 2026 YooMoney