[ Base URL: https://api.plazius.ru/pub ]
  • Примеры запросов приведены ниже в Swagger.
  • Протестировать запросы через Postman можно с помощью коллекции. В них добавлен раздел Работа с заказами.

О сценариях использования запросов API читайте в отдельном разделе.

{ "openapi": "3.0.1", "paths": {"/b2b/v1/loyalty/orders/calculate": { "post": { "tags": [ "Подсчет лояльности для заказа" ], "summary": "Посчитать лояльность для заказа", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CalculateOrderRequestDto" } } } }, "responses": { "200": { "description": "Результат успешной операции", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CalculateOrderResponseDto" } } } }, "400": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } }, "500": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } } } } } }, "components": { "schemas": { "ErrorResponseDto": { "required": [ "error" ], "type": "object", "properties": { "error": { "$ref": "#/components/schemas/ErrorDto" } }, "additionalProperties": false, "description": "Результат операции, завершившейся ошибкой" }, "ErrorDto": { "required": [ "code", "message" ], "type": "object", "properties": { "code": { "type": "string", "description": "Код ошибки", "example": "6666" }, "message": { "type": "string", "description": "Сообщение о ошибке", "example": "Some error description." } }, "additionalProperties": false, "description": "Ошибка" }, "ProductDto": { "required": [ "code", "name" ], "type": "object", "properties": { "code": { "type": "string", "description": "Код товара (артикул)", "example": "12345" }, "name": { "type": "string", "description": "Название товара", "example": "Пирог с малиной" }, "group": { "type": "string", "description": "Группа товара", "nullable": true, "example": "Мучное" }, "categories": { "type": "array", "items": { "type": "string" }, "description": "Категории товара", "nullable": true } }, "additionalProperties": false, "description": "Данные о товаре" }, "OrderItemModifierDto": { "required": [ "cost", "discount", "modifier", "price", "quantity" ], "type": "object", "properties": { "modifier": { "$ref": "#/components/schemas/ProductDto" }, "price": { "type": "number", "description": "Полная стоимость модификатора по прайсу", "format": "double", "example": 50 }, "cost": { "type": "number", "description": "Полная стоимость модификатора с учетом внеших скидок и наценок", "format": "double", "example": 30 }, "discount": { "type": "number", "description": "Общая сумма внешней скидки", "format": "double", "example": 20 }, "extraCharge": { "type": "number", "description": "Общая сумма наценки", "format": "double", "example": 0 }, "quantity": { "type": "number", "description": "Количество единиц модификатора", "format": "double", "example": 4 } }, "additionalProperties": false, "description": "Данные о модификаторе" }, "OrderItemDto": { "required": [ "cost", "price", "product", "quantity" ], "type": "object", "properties": { "product": { "$ref": "#/components/schemas/ProductDto" }, "price": { "type": "number", "description": "Полная стоимость позиции по прайсу", "format": "double", "example": 170 }, "cost": { "type": "number", "description": "Полная стоимость позиции с учетом внеших скидок и наценок", "format": "double", "example": 140 }, "discount": { "type": "number", "description": "Общая сумма внешней скидки (справочная информация, необходимая для отчетов)", "format": "double", "example": 30 }, "extraCharge": { "type": "number", "description": "Общая сумма наценки (справочная информация, необходимая для отчетов)", "format": "double", "example": 0 }, "quantity": { "type": "number", "description": "Количество единиц товара в позиции", "format": "double", "example": 4 }, "modifiers": { "type": "array", "items": { "$ref": "#/components/schemas/OrderItemModifierDto" }, "description": "Модификаторы позиции", "nullable": true } }, "additionalProperties": false, "description": "Данные о позиции заказа" }, "OrderDto": { "required": [ "items", "openedAt" ], "type": "object", "properties": { "openedAt": { "type": "string", "description": "Дата/время открытия заказа", "format": "date-time" }, "items": { "type": "array", "items": { "$ref": "#/components/schemas/OrderItemDto" }, "description": "Позиции заказа" } }, "additionalProperties": false, "description": "Данные о заказе" }, "ExpeditionTypeDto": { "enum": [ "delivery", "pickup" ], "type": "string", "description": "Способ получения заказа" }, "ExpeditionDto": { "required": [ "type" ], "type": "object", "properties": { "type": { "$ref": "#/components/schemas/ExpeditionTypeDto" } }, "additionalProperties": false, "description": "Данные о способе получения заказа" }, "DeliveryDto": { "required": [ "expedition" ], "type": "object", "properties": { "expedition": { "$ref": "#/components/schemas/ExpeditionDto" } }, "additionalProperties": false, "description": "Данные о доставке заказа" }, "PromocodeDto": { "required": [ "value" ], "type": "object", "properties": { "value": { "type": "string", "description": "Промокод" } }, "additionalProperties": false, "description": "Данные по промокоду" }, "BonusesProgramResultDto": { "required": [ "max", "min", "notifications", "progress" ], "type": "object", "properties": { "progress": { "$ref": "#/components/schemas/BonusesProgramProgressDto" }, "min": { "$ref": "#/components/schemas/BonusesDto" }, "max": { "$ref": "#/components/schemas/BonusesDto" }, "notifications": { "type": "array", "items": { "$ref": "#/components/schemas/NotificationDto" }, "description": "Уведомления о деталях срабатывания бонусной программы" } }, "additionalProperties": false, "description": "Расчет бонусной программы для заказа" }, "LoyaltyResultDetailsDto": { "required": [ "programs" ], "type": "object", "properties": { "programs": { "type": "array", "items": { "$ref": "#/components/schemas/CampaignResultDto" }, "description": "Акции" }, "bonuses": { "$ref": "#/components/schemas/BonusesProgramResultDto" } }, "additionalProperties": false, "description": "Детали расчета лояльности для заказа" }, "LoyaltyResultDto": { "required": [ "details", "fingerprint", "summary" ], "type": "object", "properties": { "fingerprint": { "type": "string", "description": "Отпечаток (хранит метаинформацию о расчете для подтверждения заказа)", "example": "UGVyc29uYWxpemVk" }, "summary": { "$ref": "#/components/schemas/LoyaltyResultSummaryDto" }, "details": { "$ref": "#/components/schemas/LoyaltyResultDetailsDto" } }, "additionalProperties": false, "description": "Расчет лояльности для заказа" }, "CalculateOrderResponseDto": { "required": [ "loyalty" ], "type": "object", "properties": { "loyalty": { "$ref": "#/components/schemas/LoyaltyResultDto" } }, "additionalProperties": false, "description": "Результат операции расчета лояльности для заказа" }, "GuestIdentityType": { "enum": [ "phone" ], "type": "string", "description": "Тип идентификатора гостя" }, "GuestIdentityDto": { "required": [ "type" ], "type": "object", "properties": { "type": { "$ref": "#/components/schemas/GuestIdentityType" }, "phone": { "type": "string", "description": "Номер телефона", "nullable": true, "example": "+79990001122" } }, "additionalProperties": false, "description": "Идентификатор гостя" }, "OrganizationIdentityType": { "enum": [ "rkObjectId" ], "type": "string", "description": "Тип идентификатора заведения" }, "OrganizationIdentityDto": { "required": [ "id", "type" ], "type": "object", "properties": { "type": { "$ref": "#/components/schemas/OrganizationIdentityType" }, "id": { "type": "string", "description": "Идентификатор", "example": "4174244" } }, "additionalProperties": false, "description": "Идентификатор заведения" }, "DiscountsByCodeDto": { "required": [ "code", "total" ], "type": "object", "properties": { "code": { "type": "string", "description": "Код товара (артикул)" }, "total": { "type": "number", "description": "Общая сумма скидки для товара", "format": "double" } }, "additionalProperties": false, "description": "Общая сумма скидки в разрезе товара" }, "DiscountsDto": { "required": [ "total", "totalByCode" ], "type": "object", "properties": { "total": { "type": "number", "description": "Общая сумма скидки в валюте заказа (например, в рублях)", "format": "double", "example": 112 }, "totalByCode": { "type": "array", "items": { "$ref": "#/components/schemas/DiscountsByCodeDto" }, "description": "Общая сумма скидки в разрезе товара в валюте заказа (например, в рублях)" } }, "additionalProperties": false, "description": "Скидки для заказа" }, "LoyaltyResultSummaryDto": { "required": [ "discounts" ], "type": "object", "properties": { "discounts": { "$ref": "#/components/schemas/DiscountsDto" }, "bonuses": { "$ref": "#/components/schemas/BonusesResultSummaryDto" } }, "additionalProperties": false, "description": "Сводка расчета лояльности для заказа" }, "NotificationDto": { "required": [ "primary", "secondary" ], "type": "object", "properties": { "primary": { "type": "string", "description": "Главное уведомление", "example": "Вы получили 50.00 бонусных баллов по акции \"Промобонусы в подарок за первый заказ\"." }, "secondary": { "type": "string", "description": "Дополнительное уведомление", "example": "Вы сможете воспользоваться специальным предложением по акции \"Промобонусы в подарок за первый заказ\" еще 3 раза." } }, "additionalProperties": false, "description": "Уведомление о деталях срабатывания акции" }, "BonusesDto": { "type": "object", "properties": { "payment": { "type": "number", "description": "(OBSOLETE!!!) Сумма оплаты в бонусных баллах", "format": "double", "example": 33, "deprecated": true }, "accrual": { "type": "number", "description": "(OBSOLETE!!!) Сумма начисления в бонусных баллах", "format": "double", "example": 17, "deprecated": true }, "payments": { "$ref": "#/components/schemas/BonusesPaymentsDto" }, "accruals": { "$ref": "#/components/schemas/BonusesAccrualsDto" } }, "additionalProperties": false, "description": "Оплата/начисление бонусных баллов" }, "BonusesPaymentsByCodeDto": { "required": [ "code", "total" ], "type": "object", "properties": { "code": { "type": "string", "description": "Код товара (артикул)" }, "total": { "type": "number", "description": "Общая сумма оплаты бонусными баллами товара", "format": "double" } }, "additionalProperties": false, "description": "Общая сумма оплаты бонусными баллами в разрезе товара" }, "BonusesPaymentsDto": { "required": [ "total", "totalByCode" ], "type": "object", "properties": { "total": { "type": "number", "description": "Общая сумма оплаты бонусными баллами", "format": "double", "example": 33 }, "totalByCode": { "type": "array", "items": { "$ref": "#/components/schemas/BonusesPaymentsByCodeDto" }, "description": "Общая сумма оплаты бонусными баллами в разрезе товара" } }, "additionalProperties": false, "description": "Оплата бонусными баллами для заказа" }, "BonusesAccrualsDto": { "required": [ "total" ], "type": "object", "properties": { "total": { "type": "number", "description": "Сумма начисления в бонусных баллах", "format": "double", "example": 17 } }, "additionalProperties": false, "description": "Начисление бонусных баллов для заказа" }, "BonusesResultSummaryDto": { "required": [ "max", "min" ], "type": "object", "properties": { "min": { "$ref": "#/components/schemas/BonusesDto" }, "max": { "$ref": "#/components/schemas/BonusesDto" } }, "additionalProperties": false, "description": "Сводка оплаты/начисления бонусных баллов для заказа" }, "RankProgressDto": { "required": [ "cashbackPercentage", "index", "name" ], "type": "object", "properties": { "name": { "type": "string", "description": "Название ранга" }, "index": { "type": "integer", "description": "Индекс текущего ранга (в списке рангов, отсчет с 0)", "format": "int32" }, "cashbackPercentage": { "type": "number", "description": "Процент бонусов\r\n<example>12.5</example>", "format": "double" }, "confirmation": { "$ref": "#/components/schemas/RankConfirmationDto" } }, "additionalProperties": false, "description": "Описывает специфичную информацию о текущем бонусном ранге пользователя" }, "RankConfirmationDto": { "required": [ "hoursLeft", "sumLeft" ], "type": "object", "properties": { "sumLeft": { "type": "number", "description": "Сумма которую необходимо потратить для подтверждения ранга", "format": "double" }, "hoursLeft": { "type": "integer", "description": "Количество часов за которые необходимо потратить сумму подтверждения", "format": "int32" } }, "additionalProperties": false, "description": "Описание требования подтверждения ранга" }, "BonusesProgramProgressDto": { "required": [ "balance", "rank" ], "type": "object", "properties": { "balance": { "type": "number", "description": "Количество бонусов в кошельке", "format": "double" }, "rank": { "$ref": "#/components/schemas/RankProgressDto" } }, "additionalProperties": false, "description": "Прогресс гостя в рамках болнусной программы" }, "CampaignResultDto": { "required": [ "notifications", "program" ], "type": "object", "properties": { "program": { "$ref": "#/components/schemas/CampaignDto" }, "discounts": { "$ref": "#/components/schemas/DiscountsDto" }, "notifications": { "type": "array", "items": { "$ref": "#/components/schemas/NotificationDto" }, "description": "Уведомления о деталях срабатывания акции" } }, "additionalProperties": false, "description": "Расчет акции для заказа" }, "CampaignDto": { "required": [ "id", "name" ], "type": "object", "properties": { "id": { "type": "string", "description": "Идентификатор акции", "format": "uuid", "example": "1de9a2d7-2ce7-4845-960b-988df56872ce" }, "name": { "type": "string", "description": "Название акции", "example": "Промобонусы в подарок за первый заказ" } }, "additionalProperties": false, "description": "Данные о акции" }, "CalculateOrderRequestDto": { "required": [ "order", "organization" ], "type": "object", "properties": { "order": { "$ref": "#/components/schemas/OrderDto" }, "organization": { "$ref": "#/components/schemas/OrganizationIdentityDto" }, "guest": { "$ref": "#/components/schemas/GuestIdentityDto" }, "delivery": { "$ref": "#/components/schemas/DeliveryDto" }, "promocodes": { "type": "array", "items": { "$ref": "#/components/schemas/PromocodeDto" }, "description": "Промокоды для применения к заказу", "nullable": true } }, "additionalProperties": false, "description": "Аргументы операции предрасчета лояльности для заказа" } } } }

Запрос loyalty/orders/calculate считает лояльность для указанного в запросе заказа.

Если не передавать и скидку и наценку, а значения price и cost будут отличаться, то скидка или наценка рассчитается автоматически.

{ "openapi": "3.0.1", "paths": { "/b2b/v1/loyalty/orders/confirm": { "post": { "tags": [ "Подтвердить заказ" ], "summary": "Подтвердить заказ", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConfirmOrderRequestDto" } } } }, "responses": { "200": { "description": "Результат успешной операции", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConfirmOrderResponseDto" } } } }, "400": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } }, "500": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } } } } } }, "components": { "schemas": { "ErrorResponseDto": { "required": [ "error" ], "type": "object", "properties": { "error": { "$ref": "#/components/schemas/ErrorDto" } }, "additionalProperties": false, "description": "Результат операции, завершившейся ошибкой" }, "ErrorDto": { "required": [ "code", "message" ], "type": "object", "properties": { "code": { "type": "string", "description": "Код ошибки", "example": "6666" }, "message": { "type": "string", "description": "Сообщение о ошибке", "example": "Some error description." } }, "additionalProperties": false, "description": "Ошибка" }, "LoyaltyConfirmationPatternDto": { "enum": [ "fingerprint" ], "type": "string", "description": "Тип подтверждения лояльности" }, "ConfirmOrderRequestDto": { "required": [ "id", "order", "organization" ], "type": "object", "properties": { "id": { "type": "string", "description": "Идентификатор заказа", "format": "uuid", "example": "46b7c469-d99c-4499-acc7-8ca26ea2117d" }, "order": { "$ref": "#/components/schemas/OrderDto" }, "organization": { "$ref": "#/components/schemas/OrganizationIdentityDto" }, "guest": { "$ref": "#/components/schemas/GuestIdentityDto" }, "delivery": { "$ref": "#/components/schemas/DeliveryDto" }, "loyalty": { "$ref": "#/components/schemas/LoyaltyConfirmationDto" } }, "additionalProperties": false, "description": "Аргументы операции подтверждения заказа" }, "LoyaltyConfirmationPatternDto": { "enum": [ "fingerprint" ], "type": "string", "description": "Тип подтверждения лояльности" }, "FingerprintConfirmationBonusesOptionDto": { "required": [ "payment" ], "type": "object", "properties": { "payment": { "type": "number", "description": "Сумма оплаты в бонусых баллах", "format": "double", "example": 37 } }, "additionalProperties": false, "description": "Подтверждение оплаты бонусами для заказа" }, "FingerprintConfirmationOptionsDto": { "type": "object", "properties": { "hold": { "type": "boolean", "description": "(Obsolete!!!) Выполнять ли холдирование? Поле необходимо для обратной совместимости" }, "bonuses": { "$ref": "#/components/schemas/FingerprintConfirmationBonusesOptionDto" } }, "additionalProperties": false, "description": "Конфигурация подтверждения по отпечатку рассчета лояльности" }, "FingerprintConfirmationDto": { "required": [ "value" ], "type": "object", "properties": { "value": { "type": "string", "description": "Отпечаток расчета", "example": "UGVyc29uYWxpemVk" }, "options": { "$ref": "#/components/schemas/FingerprintConfirmationOptionsDto" } }, "additionalProperties": false, "description": "Подтверждение по отпечатку расчета лояльности" }, "LoyaltyConfirmationDto": { "required": [ "pattern" ], "type": "object", "properties": { "pattern": { "$ref": "#/components/schemas/LoyaltyConfirmationPatternDto" }, "fingerprint": { "$ref": "#/components/schemas/FingerprintConfirmationDto" } }, "additionalProperties": false, "description": "Подтверждение лояльности для заказа" }, "ExpeditionTypeDto": { "enum": [ "delivery", "pickup" ], "type": "string", "description": "Способ получения заказа" }, "ExpeditionDto": { "required": [ "type" ], "type": "object", "properties": { "type": { "$ref": "#/components/schemas/ExpeditionTypeDto" } }, "additionalProperties": false, "description": "Данные о способе получения заказа" }, "DeliveryDto": { "required": [ "expedition" ], "type": "object", "properties": { "expedition": { "$ref": "#/components/schemas/ExpeditionDto" } }, "additionalProperties": false, "description": "Данные о доставке заказа" }, "GuestIdentityType": { "enum": [ "phone" ], "type": "string", "description": "Тип идентификатора гостя" }, "GuestIdentityDto": { "required": [ "type" ], "type": "object", "properties": { "type": { "$ref": "#/components/schemas/GuestIdentityType" }, "phone": { "type": "string", "description": "Номер телефона", "nullable": true, "example": "+79990001122" } }, "additionalProperties": false, "description": "Идентификатор гостя" }, "OrganizationIdentityDto": { "required": [ "id", "type" ], "type": "object", "properties": { "type": { "$ref": "#/components/schemas/OrganizationIdentityType" }, "id": { "type": "string", "description": "Идентификатор", "example": "4174244" } }, "additionalProperties": false, "description": "Идентификатор заведения" }, "OrganizationIdentityType": { "enum": [ "rkObjectId" ], "type": "string", "description": "Тип идентификатора заведения" }, "OrderDto": { "required": [ "items", "openedAt" ], "type": "object", "properties": { "openedAt": { "type": "string", "description": "Дата/время открытия заказа", "format": "date-time" }, "items": { "type": "array", "items": { "$ref": "#/components/schemas/OrderItemDto" }, "description": "Позиции заказа" } }, "additionalProperties": false, "description": "Данные о заказе" }, "OrderItemDto": { "required": [ "cost", "price", "product", "quantity" ], "type": "object", "properties": { "product": { "$ref": "#/components/schemas/ProductDto" }, "price": { "type": "number", "description": "Полная стоимость позиции по прайсу", "format": "double", "example": 170 }, "cost": { "type": "number", "description": "Полная стоимость позиции с учетом внеших скидок и наценок", "format": "double", "example": 140 }, "discount": { "type": "number", "description": "Общая сумма внешней скидки (справочная информация, необходимая для отчетов)", "format": "double", "example": 30 }, "extraCharge": { "type": "number", "description": "Общая сумма наценки (справочная информация, необходимая для отчетов)", "format": "double", "example": 0 }, "quantity": { "type": "number", "description": "Количество единиц товара в позиции", "format": "double", "example": 4 }, "modifiers": { "type": "array", "items": { "$ref": "#/components/schemas/OrderItemModifierDto" }, "description": "Модификаторы позиции", "nullable": true } }, "additionalProperties": false, "description": "Данные о позиции заказа" }, "OrderItemModifierDto": { "required": [ "cost", "discount", "modifier", "price", "quantity" ], "type": "object", "properties": { "modifier": { "$ref": "#/components/schemas/ProductDto" }, "price": { "type": "number", "description": "Полная стоимость модификатора по прайсу", "format": "double", "example": 50 }, "cost": { "type": "number", "description": "Полная стоимость модификатора с учетом внеших скидок и наценок", "format": "double", "example": 30 }, "discount": { "type": "number", "description": "Общая сумма внешней скидки", "format": "double", "example": 20 }, "extraCharge": { "type": "number", "description": "Общая сумма наценки", "format": "double", "example": 0 }, "quantity": { "type": "number", "description": "Количество единиц модификатора", "format": "double", "example": 4 } }, "additionalProperties": false, "description": "Данные о модификаторе" }, "OrderItemDto": { "required": [ "cost", "price", "product", "quantity" ], "type": "object", "properties": { "product": { "$ref": "#/components/schemas/ProductDto" }, "price": { "type": "number", "description": "Полная стоимость позиции по прайсу", "format": "double", "example": 170 }, "cost": { "type": "number", "description": "Полная стоимость позиции с учетом внеших скидок и наценок", "format": "double", "example": 140 }, "discount": { "type": "number", "description": "Общая сумма внешней скидки (справочная информация, необходимая для отчетов)", "format": "double", "example": 30 }, "extraCharge": { "type": "number", "description": "Общая сумма наценки (справочная информация, необходимая для отчетов)", "format": "double", "example": 0 }, "quantity": { "type": "number", "description": "Количество единиц товара в позиции", "format": "double", "example": 4 }, "modifiers": { "type": "array", "items": { "$ref": "#/components/schemas/OrderItemModifierDto" }, "description": "Модификаторы позиции", "nullable": true } }, "additionalProperties": false, "description": "Данные о позиции заказа" }, "OrderItemModifierDto": { "required": [ "cost", "discount", "modifier", "price", "quantity" ], "type": "object", "properties": { "modifier": { "$ref": "#/components/schemas/ProductDto" }, "price": { "type": "number", "description": "Полная стоимость модификатора по прайсу", "format": "double", "example": 50 }, "cost": { "type": "number", "description": "Полная стоимость модификатора с учетом внеших скидок и наценок", "format": "double", "example": 30 }, "discount": { "type": "number", "description": "Общая сумма внешней скидки", "format": "double", "example": 20 }, "extraCharge": { "type": "number", "description": "Общая сумма наценки", "format": "double", "example": 0 }, "quantity": { "type": "number", "description": "Количество единиц модификатора", "format": "double", "example": 4 } }, "additionalProperties": false, "description": "Данные о модификаторе" }, "ProductDto": { "required": [ "code", "name" ], "type": "object", "properties": { "code": { "type": "string", "description": "Код товара (артикул)", "example": "12345" }, "name": { "type": "string", "description": "Название товара", "example": "Пирог с малиной" }, "group": { "type": "string", "description": "Группа товара", "nullable": true, "example": "Мучное" }, "categories": { "type": "array", "items": { "type": "string" }, "description": "Категории товара", "nullable": true } }, "additionalProperties": false, "description": "Данные о товаре" }, "ConfirmOrderResponseDto": { "required": [ "id" ], "type": "object", "properties": { "id": { "type": "string", "description": "Идентификатор заказа", "format": "uuid", "example": "46b7c469-d99c-4499-acc7-8ca26ea2117d" } }, "additionalProperties": false, "description": "Результат операции подтверждения заказа" } } } }

Запрос loyalty/orders/confirm подтверждает применение скидки в указанном заказе.

Для подтверждения заказа укажите значение для ключа ID — UUID заказа.

  • Если в запросе не передавать скидку, но price и cost будут отличаться, то скидка рассчитается автоматически.
  • Если применять лояльность не нужно, укажите в параметре loyalty значение null
При оплате бонусами заморозка привилегий и бонусов обязательна.
{ "openapi": "3.0.1", "paths": { "/b2b/v1/loyalty/orders/reset": { "post": { "tags": [ "Сбросить заказ" ], "summary": "Сбросить заказ", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResetOrderRequestDto" } } } }, "responses": { "200": { "description": "Результат успешной операции", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResetOrderRequestDto" } } } }, "400": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } }, "500": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } } } } } }, "components": { "schemas": { "ErrorResponseDto": { "required": [ "error" ], "type": "object", "properties": { "error": { "$ref": "#/components/schemas/ErrorDto" } }, "additionalProperties": false, "description": "Результат операции, завершившейся ошибкой" }, "ErrorDto": { "required": [ "code", "message" ], "type": "object", "properties": { "code": { "type": "string", "description": "Код ошибки", "example": "6666" }, "message": { "type": "string", "description": "Сообщение о ошибке", "example": "Some error description." } }, "additionalProperties": false, "description": "Ошибка" }, "ResetOrderRequestDto": { "required": [ "id", "resetAt" ], "type": "object", "properties": { "id": { "type": "string", "description": "Идентификатор заказа", "format": "uuid", "example": "46b7c469-d99c-4499-acc7-8ca26ea2117d" }, "resetAt": { "type": "string", "description": "Дата/время сброса заказа", "format": "date-time" } }, "additionalProperties": false, "description": "Аргументы операции сброса заказа" } } } }

Запрос loyalty/orders/reset сбрасывает заказ и отменяет подтверждение расчета лояльности. 

Замороженные привилегии возвращаются гостю, а гость отвязывается от заказа. Затем заказ можно изменить, подтвердить без оплаты бонусами или без лояльности вообще.

{ "openapi": "3.0.1", "paths": { "/b2b/v1/loyalty/orders/abort": { "post": { "tags": [ "Отменить заказ" ], "summary": "Отменить заказ.", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AbortOrderRequestDto" } } } }, "responses": { "200": { "description": "Результат успешной операции", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AbortOrderResponseDto" } } } }, "400": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } }, "500": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } } } } } }, "components": { "schemas": { "ErrorResponseDto": { "required": [ "error" ], "type": "object", "properties": { "error": { "$ref": "#/components/schemas/ErrorDto" } }, "additionalProperties": false, "description": "Результат операции, завершившейся ошибкой" }, "ErrorDto": { "required": [ "code", "message" ], "type": "object", "properties": { "code": { "type": "string", "description": "Код ошибки", "example": "6666" }, "message": { "type": "string", "description": "Сообщение о ошибке", "example": "Some error description." } }, "additionalProperties": false, "description": "Ошибка" }, "AbortOrderRequestDto": { "required": [ "abortedAt", "id" ], "type": "object", "properties": { "id": { "type": "string", "description": "Идентификатор заказа", "format": "uuid", "example": "46b7c469-d99c-4499-acc7-8ca26ea2117d" }, "abortedAt": { "type": "string", "description": "Дата/время отмены заказа", "format": "date-time" } }, "additionalProperties": false, "description": "Аргументы операции отмены заказа" }, "AbortOrderResponseDto": { "required": [ "id" ], "type": "object", "properties": { "id": { "type": "string", "description": "Идентификатор заказа", "format": "uuid", "example": "46b7c469-d99c-4499-acc7-8ca26ea2117d" } }, "additionalProperties": false, "description": "Результат операции отмены заказа" } } } }

Запрос loyalty/orders/abort отменяет заказ.

Переводит заказ в терминальный статус Отменен. Дальнейшие операции с заказом запрещены, замороженные привилегии возвращаются гостю, а гость отвязывается от заказа.

{ "openapi": "3.0.1", "paths": { "/b2b/v1/loyalty/orders/close": { "post": { "tags": [ "Закрыть заказ" ], "summary": "Закрыть заказ.", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CloseOrderRequestDto" } } } }, "responses": { "200": { "description": "Результат успешной операции", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CloseOrderResponseDto" } } } }, "400": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } }, "500": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } } } } } }, "components": { "schemas": { "ErrorResponseDto": { "required": [ "error" ], "type": "object", "properties": { "error": { "$ref": "#/components/schemas/ErrorDto" } }, "additionalProperties": false, "description": "Результат операции, завершившейся ошибкой" }, "ErrorDto": { "required": [ "code", "message" ], "type": "object", "properties": { "code": { "type": "string", "description": "Код ошибки", "example": "6666" }, "message": { "type": "string", "description": "Сообщение о ошибке", "example": "Some error description." } }, "additionalProperties": false, "description": "Ошибка" }, "CloseOrderRequestDto": { "required": [ "closedAt", "id" ], "type": "object", "properties": { "id": { "type": "string", "description": "Идентификатор заказа", "format": "uuid", "example": "46b7c469-d99c-4499-acc7-8ca26ea2117d" }, "closedAt": { "type": "string", "description": "Дата/время закрытия заказа", "format": "date-time" } }, "additionalProperties": false, "description": "Аргументы операции закрытия заказа" }, "CloseOrderResponseDto": { "required": [ "id" ], "type": "object", "properties": { "id": { "type": "string", "description": "Идентификатор заказа", "format": "uuid", "example": "46b7c469-d99c-4499-acc7-8ca26ea2117d" } }, "additionalProperties": false, "description": "Результат операции закрытия заказа" } } } }

Запрос loyalty/orders/close закрывает заказ.

Списываются привилегии и начисляются бонусы за совершенный заказ.

{ "openapi": "3.0.1", "paths": { "/b2b/v1/loyalty/orders/refund": { "post": { "tags": [ "Вернуть заказ" ], "summary": "Вернуть заказ", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RefundOrderRequestDto" } } } }, "responses": { "200": { "description": "Результат успешной операции", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RefundOrderResponseDto" } } } }, "400": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } }, "500": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } } } } } }, "components": { "schemas": { "ErrorResponseDto": { "required": [ "error" ], "type": "object", "properties": { "error": { "$ref": "#/components/schemas/ErrorDto" } }, "additionalProperties": false, "description": "Результат операции, завершившейся ошибкой" }, "ErrorDto": { "required": [ "code", "message" ], "type": "object", "properties": { "code": { "type": "string", "description": "Код ошибки", "example": "6666" }, "message": { "type": "string", "description": "Сообщение о ошибке", "example": "Some error description." } }, "additionalProperties": false, "description": "Ошибка" }, "SimplifiedProductDto": { "required": [ "code" ], "type": "object", "properties": { "code": { "type": "string", "description": "Код товара (артикул)", "example": "12345" } }, "additionalProperties": false, "description": "Данные о товаре" }, "RefundedOrderItemDto": { "required": [ "product", "quantity" ], "type": "object", "properties": { "product": { "$ref": "#/components/schemas/SimplifiedProductDto" }, "quantity": { "type": "number", "description": "Количество единиц товара в позиции, которое нужно вернуть", "format": "double", "example": 4 } }, "additionalProperties": false, "description": "Данные о позиции заказа, которую нужно вернуть" }, "RefundOrderRequestDto": { "required": [ "id", "refundedAt", "refundId" ], "type": "object", "properties": { "id": { "type": "string", "description": "Идентификатор заказа", "format": "uuid", "example": "46b7c469-d99c-4499-acc7-8ca26ea2117d" }, "refundId": { "type": "string", "description": "Идентификатор возврата", "format": "uuid", "example": "9aea41ac-2d7e-4801-9ae4-9d9d39a557d9" }, "refundedAt": { "type": "string", "description": "Дата/время возврата заказа", "format": "date-time" }, "items": { "type": "array", "items": { "$ref": "#/components/schemas/RefundedOrderItemDto" }, "description": "Возвращаемые позиции заказа. Если NULL, то возвращаем весь заказ", "nullable": true } }, "additionalProperties": false, "description": "Аргументы операции возврата заказа" }, "RefundOrderResponseDto": { "required": [ "id" ], "type": "object", "properties": { "id": { "type": "string", "description": "Идентификатор заказа", "format": "uuid", "example": "46b7c469-d99c-4499-acc7-8ca26ea2117d" } }, "additionalProperties": false, "description": "Результат операции возврата заказа" } } } }

Запрос loyalty/orders/refund возвращает заказ.

Для возврата заказа укажите значение для ключа refundId — uuid возврата заказа.

В зависимости от запроса будет возвращен закрытый заказ целиком или некоторые позиции закрытого заказа. Списанные привилегии возвращаются гостю и отменяются начисления бонусов.

{ "openapi": "3.0.1", "paths": { "/b2b/v1/loyalty/orders/get": { "post": { "tags": [ "Получить информацию о заказе" ], "summary": "Получить информацию о заказе", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetOrderRequestDto" } } } }, "responses": { "200": { "description": "Результат успешной операции", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetOrderResponseDto" } } } }, "400": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } }, "500": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } } } } } }, "components": { "schemas": { "GetOrderRequestDto": { "required": [ "id" ], "type": "object", "properties": { "id": { "type": "string", "description": "Идентификатор заказа", "format": "uuid", "example": "46b7c469-d99c-4499-acc7-8ca26ea2117d" } }, "additionalProperties": false, "description": "Аргументы операции по получению деталей заказа" }, "OrderStatus": { "enum": [ "open", "closed", "aborted" ], "type": "string" }, "OrdersHistoryProductDto": { "required": [ "code", "cost", "name", "price", "quantity" ], "type": "object", "properties": { "code": { "type": "string", "description": "Код товара (артикул)", "example": "12345" }, "name": { "type": "string", "description": "Название товара", "example": "Пирог с малиной" }, "group": { "type": "string", "description": "Группа товара", "nullable": true, "example": "Мучное" }, "price": { "type": "number", "description": "Суммарная стоимость товаров в позиции по прайсу без учёта скидок. Например, для 2х кофе по 85 рублей, вернётся 170", "format": "double", "example": 170 }, "cost": { "type": "number", "description": "Суммарная стоимость товаров с учётом всех скидок", "format": "double", "example": 140 }, "quantity": { "type": "number", "description": "Количество единиц товара в позиции", "format": "double", "example": 2 } }, "additionalProperties": false, "description": "Данные о товаре" }, "OrderSource": { "enum": [ "indoor", "delivery" ], "type": "string" }, "OrdersHistoryOrderDto": { "required": [ "bonusPaymentRollbackSum", "freeProductSum", "fullSum", "id", "openTime", "organizationId", "paidWithBonuses", "products", "source", "status", "sumToPay", "еarnedBonuses" ], "type": "object", "properties": { "id": { "type": "string", "description": "ИД заказа", "format": "uuid" }, "number": { "type": "integer", "description": "Кассовый номер заказа, если есть", "format": "int32", "nullable": true }, "fullSum": { "type": "number", "description": "Суммарная стоимость заказа по прайсу без учёта скидок", "format": "double", "example": 1500 }, "sumToPay": { "type": "number", "description": "Суммарная стоимость заказа, которую необходимо оплатить (уплачена) после учёта всех скидок", "format": "double", "example": 1200 }, "freeProductSum": { "type": "number", "description": "Суммарная скидка по применённым акциям", "format": "double", "example": 150 }, "paidWithBonuses": { "type": "number", "description": "Сколько бонусов был списано для оплаты заказа", "format": "double", "example": 150 }, "еarnedBonuses": { "type": "number", "description": "Сколько бонусов был начислено за заказ", "format": "double", "example": 100 }, "bonusPaymentRollbackSum": { "type": "number", "description": "Сумма возврата бонусов (для отменённых заказов)", "format": "double", "example": 100 }, "openTime": { "type": "string", "description": "Дата открытия заказа", "format": "date-time" }, "closeTime": { "type": "string", "description": "Дата закрытия заказа", "format": "date-time", "nullable": true }, "status": { "$ref": "#/components/schemas/OrderStatus" }, "products": { "type": "array", "items": { "$ref": "#/components/schemas/OrdersHistoryProductDto" }, "description": "Позиции в заказе" }, "organizationId": { "type": "string", "description": "Id организации, в которой был сделан заказ", "format": "uuid" }, "source": { "$ref": "#/components/schemas/OrderSource" } }, "additionalProperties": false, "description": "Данные о заказе" }, "GetOrderResponseDto": { "required": [ "order" ], "type": "object", "properties": { "order": { "$ref": "#/components/schemas/OrdersHistoryOrderDto" } }, "additionalProperties": false, "description": "Результат операции по получению деталей заказа" }, "ErrorDto": { "required": [ "code", "message" ], "type": "object", "properties": { "code": { "type": "string", "description": "Код ошибки", "example": "6666" }, "message": { "type": "string", "description": "Сообщение о ошибке", "example": "Some error description." } }, "additionalProperties": false, "description": "Ошибка" }, "ErrorResponseDto": { "required": [ "error" ], "type": "object", "properties": { "error": { "$ref": "#/components/schemas/ErrorDto" } }, "additionalProperties": false, "description": "Результат операции, завершившейся ошибкой" } } } }

Запрос loyalty/orders/get получает информацию о заказе заказа.

Проверка прав на получение информации о заказе осуществляется по организациям, на которые имеются права доступа для используемого ApiKey.

Возможные ошибки и их решения

Код ошибкиОписаниеВозможные причины
1001Ошибка работы с закрытым заказом.Заказ закрыт.
1002Заказ в статусе Отменен.

Заказ отменен.

1013Возвращаемый заказ не закрыт.Невозможно вернуть заказ, который не закрыт. Выполните запрос Отмена заказа.
1014Список блюд для возврата содержит некорректные данные.Причины могут быть разные. Например, количество единиц блюда, которые необходимо вернуть, больше, чем количество единиц в заказе. Или такого блюда вообще не существует. 
2004Организация не найдена.

Данные в запросе содержат ошибку.

Проверьте лицензию Plazius API в Системе лицензирования. Если ее нет, то организации либо не существует в Plazius, либо она отключена и сервис лояльности для нее недоступен.

9004Ошибка валидации входных данных.

Не все обязательные данные переданы в запросе или данные в запросе содержат ошибку