# [YooKassa API SDK](../home.md) # Class: \YooKassa\Helpers\ProductCode ### Namespace: [\YooKassa\Helpers](../namespaces/yookassa-helpers.md) --- **Summary:** Класс для формирования тега 1162 на основе кода в формате Data Matrix --- ### Examples 04-product-code.php 6 7 Вариант через метод ```php ``` 04-product-code.php 15 7 Вариант через массив ```php ``` --- ### Constants | Visibility | Name | Flag | Summary | | ----------:| ---- | ---- | ------- | | public | [PREFIX_DATA_MATRIX](../classes/YooKassa-Helpers-ProductCode.md#constant_PREFIX_DATA_MATRIX) | | | | public | [PREFIX_UNKNOWN](../classes/YooKassa-Helpers-ProductCode.md#constant_PREFIX_UNKNOWN) | | | | public | [PREFIX_EAN_8](../classes/YooKassa-Helpers-ProductCode.md#constant_PREFIX_EAN_8) | | | | public | [PREFIX_EAN_13](../classes/YooKassa-Helpers-ProductCode.md#constant_PREFIX_EAN_13) | | | | public | [PREFIX_ITF_14](../classes/YooKassa-Helpers-ProductCode.md#constant_PREFIX_ITF_14) | | | | public | [PREFIX_FUR](../classes/YooKassa-Helpers-ProductCode.md#constant_PREFIX_FUR) | | | | public | [PREFIX_EGAIS_20](../classes/YooKassa-Helpers-ProductCode.md#constant_PREFIX_EGAIS_20) | | | | public | [PREFIX_EGAIS_30](../classes/YooKassa-Helpers-ProductCode.md#constant_PREFIX_EGAIS_30) | | | | public | [TYPE_UNKNOWN](../classes/YooKassa-Helpers-ProductCode.md#constant_TYPE_UNKNOWN) | | | | public | [TYPE_EAN_8](../classes/YooKassa-Helpers-ProductCode.md#constant_TYPE_EAN_8) | | | | public | [TYPE_EAN_13](../classes/YooKassa-Helpers-ProductCode.md#constant_TYPE_EAN_13) | | | | public | [TYPE_ITF_14](../classes/YooKassa-Helpers-ProductCode.md#constant_TYPE_ITF_14) | | | | public | [TYPE_GS_10](../classes/YooKassa-Helpers-ProductCode.md#constant_TYPE_GS_10) | | | | public | [TYPE_GS_1M](../classes/YooKassa-Helpers-ProductCode.md#constant_TYPE_GS_1M) | | | | public | [TYPE_SHORT](../classes/YooKassa-Helpers-ProductCode.md#constant_TYPE_SHORT) | | | | public | [TYPE_FUR](../classes/YooKassa-Helpers-ProductCode.md#constant_TYPE_FUR) | | | | public | [TYPE_EGAIS_20](../classes/YooKassa-Helpers-ProductCode.md#constant_TYPE_EGAIS_20) | | | | public | [TYPE_EGAIS_30](../classes/YooKassa-Helpers-ProductCode.md#constant_TYPE_EGAIS_30) | | | | public | [AI_GTIN](../classes/YooKassa-Helpers-ProductCode.md#constant_AI_GTIN) | | | | public | [AI_SERIAL](../classes/YooKassa-Helpers-ProductCode.md#constant_AI_SERIAL) | | | | public | [AI_SUM](../classes/YooKassa-Helpers-ProductCode.md#constant_AI_SUM) | | | | public | [MAX_PRODUCT_CODE_LENGTH](../classes/YooKassa-Helpers-ProductCode.md#constant_MAX_PRODUCT_CODE_LENGTH) | | | | public | [MAX_MARK_CODE_LENGTH](../classes/YooKassa-Helpers-ProductCode.md#constant_MAX_MARK_CODE_LENGTH) | | | --- ### Methods | Visibility | Name | Flag | Summary | | ----------:| ---- | ---- | ------- | | public | [__construct()](../classes/YooKassa-Helpers-ProductCode.md#method___construct) | | ProductCode constructor. | | public | [__toString()](../classes/YooKassa-Helpers-ProductCode.md#method___toString) | | Приводит объект к строке | | public | [calcResult()](../classes/YooKassa-Helpers-ProductCode.md#method_calcResult) | | Формирует тег 1162. | | public | [getAppIdentifiers()](../classes/YooKassa-Helpers-ProductCode.md#method_getAppIdentifiers) | | Возвращает массив дополнительных идентификаторов применения | | public | [getGtin()](../classes/YooKassa-Helpers-ProductCode.md#method_getGtin) | | Возвращает глобальный номер товарной продукции | | public | [getMarkCodeInfo()](../classes/YooKassa-Helpers-ProductCode.md#method_getMarkCodeInfo) | | | | public | [getPrefix()](../classes/YooKassa-Helpers-ProductCode.md#method_getPrefix) | | Возвращает код типа маркировки | | public | [getResult()](../classes/YooKassa-Helpers-ProductCode.md#method_getResult) | | Возвращает сформированный тег 1162. | | public | [getSerial()](../classes/YooKassa-Helpers-ProductCode.md#method_getSerial) | | Возвращает серийный номер товара | | public | [getType()](../classes/YooKassa-Helpers-ProductCode.md#method_getType) | | Возвращает тип маркировки | | public | [isUsePrefix()](../classes/YooKassa-Helpers-ProductCode.md#method_isUsePrefix) | | Возвращает флаг использования кода типа маркировки | | public | [setAppIdentifiers()](../classes/YooKassa-Helpers-ProductCode.md#method_setAppIdentifiers) | | Устанавливает массив дополнительных идентификаторов применения | | public | [setGtin()](../classes/YooKassa-Helpers-ProductCode.md#method_setGtin) | | Устанавливает глобальный номер товарной продукции | | public | [setMarkCodeInfo()](../classes/YooKassa-Helpers-ProductCode.md#method_setMarkCodeInfo) | | | | public | [setPrefix()](../classes/YooKassa-Helpers-ProductCode.md#method_setPrefix) | | Устанавливает код типа маркировки | | public | [setSerial()](../classes/YooKassa-Helpers-ProductCode.md#method_setSerial) | | Устанавливает серийный номер товара | | public | [setType()](../classes/YooKassa-Helpers-ProductCode.md#method_setType) | | Устанавливает тип маркировки | | public | [setUsePrefix()](../classes/YooKassa-Helpers-ProductCode.md#method_setUsePrefix) | | Устанавливает флаг использования кода типа маркировки | | public | [validate()](../classes/YooKassa-Helpers-ProductCode.md#method_validate) | | Проверяет заполненность необходимых свойств | --- ### Details * File: [lib/Helpers/ProductCode.php](../../lib/Helpers/ProductCode.php) * Package: YooKassa * Class Hierarchy: * \YooKassa\Helpers\ProductCode * See Also: * [](https://git.yoomoney.ru/projects/SDK/repos/yookassa-sdk-php/browse/lib/Helpers/ProductCode.php) --- ## Constants ###### PREFIX_DATA_MATRIX ```php PREFIX_DATA_MATRIX = '444D' : string ``` ###### PREFIX_UNKNOWN ```php PREFIX_UNKNOWN = '0000' : string ``` ###### PREFIX_EAN_8 ```php PREFIX_EAN_8 = '4508' : string ``` ###### PREFIX_EAN_13 ```php PREFIX_EAN_13 = '450D' : string ``` ###### PREFIX_ITF_14 ```php PREFIX_ITF_14 = '4909' : string ``` ###### PREFIX_FUR ```php PREFIX_FUR = '5246' : string ``` ###### PREFIX_EGAIS_20 ```php PREFIX_EGAIS_20 = 'C514' : string ``` ###### PREFIX_EGAIS_30 ```php PREFIX_EGAIS_30 = 'C51E' : string ``` ###### TYPE_UNKNOWN ```php TYPE_UNKNOWN = 'unknown' : string ``` ###### TYPE_EAN_8 ```php TYPE_EAN_8 = 'ean_8' : string ``` ###### TYPE_EAN_13 ```php TYPE_EAN_13 = 'ean_13' : string ``` ###### TYPE_ITF_14 ```php TYPE_ITF_14 = 'itf_14' : string ``` ###### TYPE_GS_10 ```php TYPE_GS_10 = 'gs_10' : string ``` ###### TYPE_GS_1M ```php TYPE_GS_1M = 'gs_1m' : string ``` ###### TYPE_SHORT ```php TYPE_SHORT = 'short' : string ``` ###### TYPE_FUR ```php TYPE_FUR = 'fur' : string ``` ###### TYPE_EGAIS_20 ```php TYPE_EGAIS_20 = 'egais_20' : string ``` ###### TYPE_EGAIS_30 ```php TYPE_EGAIS_30 = 'egais_30' : string ``` ###### AI_GTIN ```php AI_GTIN = '01' : string ``` ###### AI_SERIAL ```php AI_SERIAL = '21' : string ``` ###### AI_SUM ```php AI_SUM = '8005' : string ``` ###### MAX_PRODUCT_CODE_LENGTH ```php MAX_PRODUCT_CODE_LENGTH = 30 : int ``` ###### MAX_MARK_CODE_LENGTH ```php MAX_MARK_CODE_LENGTH = 32 : int ``` --- ## Methods #### public __construct() : mixed ```php public __construct(string|null $codeDataMatrix = null, bool|string $usePrefix = true) : mixed ``` **Summary** ProductCode constructor. **Details:** * Inherited From: [\YooKassa\Helpers\ProductCode](../classes/YooKassa-Helpers-ProductCode.md) ##### Parameters: | Type | Name | Description | | ---- | ---- | ----------- | | string OR null | codeDataMatrix | Строка, расшифрованная из QR-кода | | bool OR string | usePrefix | Нужен ли код типа маркировки в результате | **Returns:** mixed - #### public __toString() : string ```php public __toString() : string ``` **Summary** Приводит объект к строке **Details:** * Inherited From: [\YooKassa\Helpers\ProductCode](../classes/YooKassa-Helpers-ProductCode.md) **Returns:** string - #### public calcResult() : string ```php public calcResult() : string ``` **Summary** Формирует тег 1162. **Details:** * Inherited From: [\YooKassa\Helpers\ProductCode](../classes/YooKassa-Helpers-ProductCode.md) **Returns:** string - Сформированный тег 1162. #### public getAppIdentifiers() : array|null ```php public getAppIdentifiers() : array|null ``` **Summary** Возвращает массив дополнительных идентификаторов применения **Details:** * Inherited From: [\YooKassa\Helpers\ProductCode](../classes/YooKassa-Helpers-ProductCode.md) **Returns:** array|null - Массив дополнительных идентификаторов применения #### public getGtin() : string ```php public getGtin() : string ``` **Summary** Возвращает глобальный номер товарной продукции **Details:** * Inherited From: [\YooKassa\Helpers\ProductCode](../classes/YooKassa-Helpers-ProductCode.md) **Returns:** string - Глобальный номер товарной продукции #### public getMarkCodeInfo() : \YooKassa\Model\Receipt\MarkCodeInfo ```php public getMarkCodeInfo() : \YooKassa\Model\Receipt\MarkCodeInfo ``` **Details:** * Inherited From: [\YooKassa\Helpers\ProductCode](../classes/YooKassa-Helpers-ProductCode.md) **Returns:** \YooKassa\Model\Receipt\MarkCodeInfo - #### public getPrefix() : string ```php public getPrefix() : string ``` **Summary** Возвращает код типа маркировки **Details:** * Inherited From: [\YooKassa\Helpers\ProductCode](../classes/YooKassa-Helpers-ProductCode.md) **Returns:** string - Код типа маркировки #### public getResult() : string ```php public getResult() : string ``` **Summary** Возвращает сформированный тег 1162. **Details:** * Inherited From: [\YooKassa\Helpers\ProductCode](../classes/YooKassa-Helpers-ProductCode.md) **Returns:** string - Сформированный тег 1162. #### public getSerial() : string ```php public getSerial() : string ``` **Summary** Возвращает серийный номер товара **Details:** * Inherited From: [\YooKassa\Helpers\ProductCode](../classes/YooKassa-Helpers-ProductCode.md) **Returns:** string - Серийный номер товара #### public getType() : string ```php public getType() : string ``` **Summary** Возвращает тип маркировки **Details:** * Inherited From: [\YooKassa\Helpers\ProductCode](../classes/YooKassa-Helpers-ProductCode.md) **Returns:** string - Тип маркировки #### public isUsePrefix() : bool ```php public isUsePrefix() : bool ``` **Summary** Возвращает флаг использования кода типа маркировки **Details:** * Inherited From: [\YooKassa\Helpers\ProductCode](../classes/YooKassa-Helpers-ProductCode.md) **Returns:** bool - #### public setAppIdentifiers() : mixed ```php public setAppIdentifiers(array|null $appIdentifiers) : mixed ``` **Summary** Устанавливает массив дополнительных идентификаторов применения **Details:** * Inherited From: [\YooKassa\Helpers\ProductCode](../classes/YooKassa-Helpers-ProductCode.md) ##### Parameters: | Type | Name | Description | | ---- | ---- | ----------- | | array OR null | appIdentifiers | Массив дополнительных идентификаторов применения | **Returns:** mixed - #### public setGtin() : \YooKassa\Helpers\ProductCode ```php public setGtin(string $gtin) : \YooKassa\Helpers\ProductCode ``` **Summary** Устанавливает глобальный номер товарной продукции **Details:** * Inherited From: [\YooKassa\Helpers\ProductCode](../classes/YooKassa-Helpers-ProductCode.md) ##### Parameters: | Type | Name | Description | | ---- | ---- | ----------- | | string | gtin | Глобальный номер товарной продукции | **Returns:** \YooKassa\Helpers\ProductCode - #### public setMarkCodeInfo() : mixed ```php public setMarkCodeInfo(\YooKassa\Model\Receipt\MarkCodeInfo|array|string $markCodeInfo) : mixed ``` **Details:** * Inherited From: [\YooKassa\Helpers\ProductCode](../classes/YooKassa-Helpers-ProductCode.md) ##### Parameters: | Type | Name | Description | | ---- | ---- | ----------- | | \YooKassa\Model\Receipt\MarkCodeInfo OR array OR string | markCodeInfo | | **Returns:** mixed - #### public setPrefix() : \YooKassa\Helpers\ProductCode ```php public setPrefix(string|int $prefix) : \YooKassa\Helpers\ProductCode ``` **Summary** Устанавливает код типа маркировки **Details:** * Inherited From: [\YooKassa\Helpers\ProductCode](../classes/YooKassa-Helpers-ProductCode.md) ##### Parameters: | Type | Name | Description | | ---- | ---- | ----------- | | string OR int | prefix | Код типа маркировки | **Returns:** \YooKassa\Helpers\ProductCode - #### public setSerial() : \YooKassa\Helpers\ProductCode ```php public setSerial(string $serial) : \YooKassa\Helpers\ProductCode ``` **Summary** Устанавливает серийный номер товара **Details:** * Inherited From: [\YooKassa\Helpers\ProductCode](../classes/YooKassa-Helpers-ProductCode.md) ##### Parameters: | Type | Name | Description | | ---- | ---- | ----------- | | string | serial | Серийный номер товара | **Returns:** \YooKassa\Helpers\ProductCode - #### public setType() : mixed ```php public setType(string $type) : mixed ``` **Summary** Устанавливает тип маркировки **Details:** * Inherited From: [\YooKassa\Helpers\ProductCode](../classes/YooKassa-Helpers-ProductCode.md) ##### Parameters: | Type | Name | Description | | ---- | ---- | ----------- | | string | type | Тип маркировки | **Returns:** mixed - #### public setUsePrefix() : \YooKassa\Helpers\ProductCode ```php public setUsePrefix(bool $usePrefix) : \YooKassa\Helpers\ProductCode ``` **Summary** Устанавливает флаг использования кода типа маркировки **Details:** * Inherited From: [\YooKassa\Helpers\ProductCode](../classes/YooKassa-Helpers-ProductCode.md) ##### Parameters: | Type | Name | Description | | ---- | ---- | ----------- | | bool | usePrefix | Флаг использования кода типа маркировки | **Returns:** \YooKassa\Helpers\ProductCode - #### public validate() : bool ```php public validate() : bool ``` **Summary** Проверяет заполненность необходимых свойств **Details:** * Inherited From: [\YooKassa\Helpers\ProductCode](../classes/YooKassa-Helpers-ProductCode.md) **Returns:** bool - --- ### Top Namespaces * [\YooKassa](../namespaces/yookassa.md) --- ### Reports * [Errors - 0](../reports/errors.md) * [Markers - 1](../reports/markers.md) * [Deprecated - 25](../reports/deprecated.md) --- This document was automatically generated from source code comments on 2023-04-06 using [phpDocumentor](http://www.phpdoc.org/) © 2023 YooMoney