# [YooKassa API SDK](../home.md)
# Class: \YooKassa\Common\Exceptions\ForbiddenException
### Namespace: [\YooKassa\Common\Exceptions](../namespaces/yookassa-common-exceptions.md)
---
**Summary:**
Секретный ключ или OAuth-токен верный, но не хватает прав для совершения операции.
---
### Constants
| Visibility | Name | Flag | Summary |
| ----------:| ---- | ---- | ------- |
| public | [HTTP_CODE](../classes/YooKassa-Common-Exceptions-ForbiddenException.md#constant_HTTP_CODE) | | |
---
### Properties
| Visibility | Name | Flag | Summary |
| ----------:| ---- | ---- | ------- |
| public | [$retryAfter](../classes/YooKassa-Common-Exceptions-ApiException.md#property_retryAfter) | *deprecated* | |
| public | [$type](../classes/YooKassa-Common-Exceptions-ApiException.md#property_type) | *deprecated* | |
| protected | [$error](../classes/YooKassa-Common-Exceptions-ApiException.md#property_error) | | |
| protected | [$responseBody](../classes/YooKassa-Common-Exceptions-ApiException.md#property_responseBody) | | |
| protected | [$responseHeaders](../classes/YooKassa-Common-Exceptions-ApiException.md#property_responseHeaders) | | |
---
### Methods
| Visibility | Name | Flag | Summary |
| ----------:| ---- | ---- | ------- |
| public | [__construct()](../classes/YooKassa-Common-Exceptions-ForbiddenException.md#method___construct) | | Constructor. |
| public | [getError()](../classes/YooKassa-Common-Exceptions-ApiException.md#method_getError) | | Возвращает объект ошибки |
| public | [getErrorCode()](../classes/YooKassa-Common-Exceptions-ApiException.md#method_getErrorCode) | *deprecated* | |
| public | [getErrorDescription()](../classes/YooKassa-Common-Exceptions-ApiException.md#method_getErrorDescription) | *deprecated* | |
| public | [getErrorId()](../classes/YooKassa-Common-Exceptions-ApiException.md#method_getErrorId) | *deprecated* | |
| public | [getErrorParameter()](../classes/YooKassa-Common-Exceptions-ApiException.md#method_getErrorParameter) | *deprecated* | |
| public | [getResponseBody()](../classes/YooKassa-Common-Exceptions-ApiException.md#method_getResponseBody) | | |
| public | [getResponseHeaders()](../classes/YooKassa-Common-Exceptions-ApiException.md#method_getResponseHeaders) | | |
| protected | [createMessageFromError()](../classes/YooKassa-Common-Exceptions-ApiException.md#method_createMessageFromError) | | Создает сообщение из объекта ошибки |
| protected | [parseErrorBody()](../classes/YooKassa-Common-Exceptions-ApiException.md#method_parseErrorBody) | | Подготавливает объект ошибки |
---
### Details
* File: [lib/Common/Exceptions/ForbiddenException.php](../../lib/Common/Exceptions/ForbiddenException.php)
* Package: Default
* Class Hierarchy:
* [\Exception](\Exception)
* [\YooKassa\Common\Exceptions\ApiException](../classes/YooKassa-Common-Exceptions-ApiException.md)
* \YooKassa\Common\Exceptions\ForbiddenException
---
## Constants
###### HTTP_CODE
```php
HTTP_CODE = 403
```
---
## Properties
#### public $retryAfter : mixed - (deprecated)
---
**Type:** mixed
Время в секундах до повторной попытки
**Details:**
* Inherited From: [\YooKassa\Common\Exceptions\ApiException](../classes/YooKassa-Common-Exceptions-ApiException.md)
#### public $type : mixed - (deprecated)
---
**Type:** mixed
Тип ошибки
**Details:**
* Inherited From: [\YooKassa\Common\Exceptions\ApiException](../classes/YooKassa-Common-Exceptions-ApiException.md)
#### protected $error : ?\YooKassa\Common\Errors\AbstractError
---
**Type:** AbstractError
Объект ошибки
**Details:**
* Inherited From: [\YooKassa\Common\Exceptions\ApiException](../classes/YooKassa-Common-Exceptions-ApiException.md)
#### protected $responseBody : ?string
---
**Type:** ?string
**Details:**
* Inherited From: [\YooKassa\Common\Exceptions\ApiException](../classes/YooKassa-Common-Exceptions-ApiException.md)
#### protected $responseHeaders : array
---
**Type:** array
**Details:**
* Inherited From: [\YooKassa\Common\Exceptions\ApiException](../classes/YooKassa-Common-Exceptions-ApiException.md)
---
## Methods
#### public __construct() : mixed
```php
public __construct(mixed $responseHeaders = [], mixed $responseBody = '') : mixed
```
**Summary**
Constructor.
**Details:**
* Inherited From: [\YooKassa\Common\Exceptions\ForbiddenException](../classes/YooKassa-Common-Exceptions-ForbiddenException.md)
##### Parameters:
| Type | Name | Description |
| ---- | ---- | ----------- |
| mixed | responseHeaders | HTTP header |
| mixed | responseBody | HTTP body |
**Returns:** mixed -
#### public getError() : \YooKassa\Common\Errors\AbstractError|null
```php
public getError() : \YooKassa\Common\Errors\AbstractError|null
```
**Summary**
Возвращает объект ошибки
**Details:**
* Inherited From: [\YooKassa\Common\Exceptions\ApiException](../classes/YooKassa-Common-Exceptions-ApiException.md)
**Returns:** \YooKassa\Common\Errors\AbstractError|null -
#### (deprecated) - public getErrorCode() : ?string
```php
public getErrorCode() : ?string
```
**Deprecated**
DeprecatedУстарело. Вместо него нужно использовать getError()->getCode()
**Details:**
* Inherited From: [\YooKassa\Common\Exceptions\ApiException](../classes/YooKassa-Common-Exceptions-ApiException.md)
**Returns:** ?string -
#### (deprecated) - public getErrorDescription() : ?string
```php
public getErrorDescription() : ?string
```
**Deprecated**
DeprecatedУстарело. Вместо него нужно использовать getError()->getDescription()
**Details:**
* Inherited From: [\YooKassa\Common\Exceptions\ApiException](../classes/YooKassa-Common-Exceptions-ApiException.md)
**Returns:** ?string -
#### (deprecated) - public getErrorId() : ?string
```php
public getErrorId() : ?string
```
**Deprecated**
DeprecatedУстарело. Вместо него нужно использовать getError()->getId()
**Details:**
* Inherited From: [\YooKassa\Common\Exceptions\ApiException](../classes/YooKassa-Common-Exceptions-ApiException.md)
**Returns:** ?string -
#### (deprecated) - public getErrorParameter() : ?string
```php
public getErrorParameter() : ?string
```
**Deprecated**
DeprecatedУстарело. Вместо него нужно использовать getError()->getParameter()
**Details:**
* Inherited From: [\YooKassa\Common\Exceptions\ApiException](../classes/YooKassa-Common-Exceptions-ApiException.md)
**Returns:** ?string -
#### public getResponseBody() : ?string
```php
public getResponseBody() : ?string
```
**Details:**
* Inherited From: [\YooKassa\Common\Exceptions\ApiException](../classes/YooKassa-Common-Exceptions-ApiException.md)
**Returns:** ?string -
#### public getResponseHeaders() : string[]
```php
public getResponseHeaders() : string[]
```
**Details:**
* Inherited From: [\YooKassa\Common\Exceptions\ApiException](../classes/YooKassa-Common-Exceptions-ApiException.md)
**Returns:** string[] -
#### protected createMessageFromError() : string
```php
protected createMessageFromError(mixed $responseBody) : string
```
**Summary**
Создает сообщение из объекта ошибки
**Details:**
* Inherited From: [\YooKassa\Common\Exceptions\ApiException](../classes/YooKassa-Common-Exceptions-ApiException.md)
##### Parameters:
| Type | Name | Description |
| ---- | ---- | ----------- |
| mixed | responseBody | |
**Returns:** string -
#### protected parseErrorBody() : void
```php
protected parseErrorBody(array $errorData) : void
```
**Summary**
Подготавливает объект ошибки
**Details:**
* Inherited From: [\YooKassa\Common\Exceptions\ApiException](../classes/YooKassa-Common-Exceptions-ApiException.md)
##### Parameters:
| Type | Name | Description |
| ---- | ---- | ----------- |
| array | errorData | |
**Returns:** void -
---
### 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