# Погашение промокода Использует код акции с промокодами. После погашения промокода пользователь получит бесплатные товары и/или цена корзины и/или отдельных товаров будет снижена. Endpoint: POST /v2/project/{project_id}/promocode/redeem Version: 2.0.0 Security: AuthForCart ## Path parameters: - `project_id` (integer, required) ID проекта. Вы можете найти этот параметр в Личном кабинете рядом с названием проекта. Example: 44056 ## Request fields (application/json): - `cart` (object,null) - `cart.id` (string, required) ID корзины. - `coupon_code` (string) Уникальный код промокода. Содержит буквы и цифры. Example: "SUMMER2021" - `selected_unit_items` (object) Награда, выбранная пользователем. Ключ объекта — это артикул юнита, а значение — артикул одного из товаров в юните. Example: {"game_1":"game_1_steam","game_2":"game_2_playstation"} ## Response 200 fields (application/json): - `cart_id` (string) ID корзины. Example: "cart_id" - `is_free` (boolean) Если true, товар бесплатный. - `items` (array) Example: [{"attributes":[],"can_be_bought":{"$ref":"../schemas/Can_be_bought.yaml"},"description":"Take it, take it all! All of Xsolla's riches in one Mega Booster.","groups":[{"external_id":"powerups","name":"Power Ups"}],"image_url":"https://cdn.xsolla.net/img/misc/images/e9f2f4a634bc96ea03b5d5ceadd7c55f.png","is_free":false,"limits":{"$ref":"../schemas/Catalog_item_limits.yaml"},"name":"Xsolla Booster Mega","periods":{"$ref":"../schemas/item-periods.yaml"},"price":{"amount":"50.0000000000000000","amount_without_discount":"100.0000000000000000","currency":"USD"},"promotions":{"$ref":"../schemas/Catalog_item_promotions.yaml"},"quantity":123,"sku":"com.xsolla.booster_mega_1","type":"virtual_good","virtual_item_type":"consumable","virtual_prices":[],"vp_rewards":{"$ref":"../schemas/reward-chain-client/client-item-value-point-reward.yaml"}}] - `items.can_be_bought` (boolean) Если true, пользователь может купить товар. Example: true - `items.description` (string) - `items.groups` (array) - `items.groups.external_id` (string) - `items.groups.name` (string) - `items.image_url` (string) - `items.limits` (object,null) Ограничения на продажу товара. - `items.limits.per_item` (object,null) Ограничения на продажу для конкретного товара. - `items.limits.per_item.available` (integer) Оставшееся количество товара, которое могут приобрести все пользователи. Example: 3 - `items.limits.per_item.total` (integer) Максимальное количество товара, которое могут приобрести все пользователи. Example: 5 - `items.limits.per_user` (object,null) Ограничения на продажу товара для пользователя. - `items.limits.per_user.available` (integer) Оставшееся количество товара, которое может приобрести текущий пользователь. Example: 3 - `items.limits.per_user.limit_exceeded_visibility` (string) Определяет видимость товара в каталоге после достижения лимита покупок до момента следующего обновления лимитов. Применяется к товарам, для которых задано регулярное обновление лимитов в массиве recurrent_schedule. Если обновление лимитов не задано, товар не отображается в каталоге после достижения лимита независимо от значения limit_exceeded_visibility. Enum: "show", "hide" - `items.limits.per_user.recurrent_schedule` (object) Период обновления ограничений на продажу товара для пользователя. - `items.limits.per_user.recurrent_schedule.interval_type` (string) Период обновления ограничения на продажу товара. Enum: "daily", "weekly", "monthly", "hourly" - `items.limits.per_user.recurrent_schedule.reset_next_date` (integer) Дата и время обновления ограничений (Unix Timestamp). Example: 1677553200 - `items.limits.per_user.total` (integer) Максимальное количество товара, которое может приобрести один пользователь. Example: 5 - `items.periods` (array,null) Период продажи товара. - `items.periods.date_from` (string) Дата, когда указанный товар будет доступен для продажи. Example: "2020-08-11T10:00:00+03:00" - `items.periods.date_until` (string,null) Дата, когда указанный товар станет недоступен для продажи. Может быть null. Example: "2020-08-11T20:00:00+03:00" - `items.promotions` (array) Примененные акции для отдельных товаров в корзине. Массив возвращается, если: * Скидочная акция настроена для отдельного товара. * Используется промокод с настройкой Скидка на выбранные товары. Если акции на уровне отдельных товаров не применялись, возвращается пустой массив. - `items.promotions.bonus` (array) - `items.promotions.bonus.bundle_type` (string) Тип товара бонусного бандла. Доступно только для бонусного товара типа bundle. Enum: "standard", "virtual_currency_package" - `items.promotions.bonus.image_url` (string) URL-адрес изображения бонусного бандла. Недоступно для типа бонусного товара physical_good. - `items.promotions.bonus.name` (string) Название бонусного товара. Недоступно для типа бонусного товара physical_good. - `items.promotions.bonus.quantity` (integer) - `items.promotions.bonus.sku` (string) - `items.promotions.bonus.type` (string) Тип бонусного товара. Enum: "virtual_good", "virtual_currency", "bundle", "physical_good", "game_key", "nft" - `items.promotions.date_end` (string,null) - `items.promotions.date_start` (string,null) - `items.promotions.discount` (object,null) - `items.promotions.discount.percent` (string,null) - `items.promotions.discount.value` (string,null) - `items.promotions.limits` (object) - `items.promotions.limits.per_user` (object) - `items.promotions.limits.per_user.available` (integer) - `items.promotions.limits.per_user.total` (integer) - `items.type` (string) - `items.vp_rewards` (array) Стоимость призовых баллов товара. - `items.vp_rewards.amount` (integer) Количество призовых баллов. - `items.vp_rewards.image_url` (string) URL-адрес изображения. Example: "https://image.example.com" - `items.vp_rewards.is_clan` (boolean) Может ли призовой балл использоваться в цепочках наград для клана. Example: true - `items.vp_rewards.item_id` (integer) Внутренний уникальный ID виртуального предмета или валюты. Example: 1 - `items.vp_rewards.name` (string) Название призовых баллов. - `items.vp_rewards.sku` (string) Уникальный ID призовых баллов. - `price` (object,null) Цена корзины. Example: {"amount":"6150.0000000000000000","amount_without_discount":"6150.0000000000000000","currency":"USD"} - `price.amount` (string) Example: "6150.0000000000000000" - `price.amount_without_discount` (string) Example: "6150.0000000000000000" - `price.currency` (string) Example: "USD" - `rewards` (object) - `rewards.discount` (object,null) Процент скидки. Цена корзины будет уменьшена с использованием значения, рассчитанного с использованием этого процента, а затем округлена до 2 знаков после запятой. - `rewards.discounted_items` (array,null) Список товаров, на которые действует скидка по промокоду. - `rewards.discounted_items.sku` (string, required) Артикул товара. - `rewards.is_selectable` (boolean) Если true, пользователь должен выбрать бонус перед погашением промокода. ## Response 401 fields (application/json): - `errorCode` (integer) Example: 1501 - `errorMessage` (string) Example: "[0401-1501]: Authorization failed: Provide authorization" - `statusCode` (integer) Example: 401 ## Response 403 fields (application/json): - `errorCode` (integer) - `errorMessage` (string) Example: "Authorization header not sent." - `statusCode` (integer) Example: 403 - `transactionId` (string) Example: "x-x-x-x-transactionId-mock-x-x-x" ## Response 404 fields (application/json): - `errorCode` (integer) Example: 4001 - `errorMessage` (string) Example: "[0401-9807]: Enter valid promo code." - `statusCode` (integer) Example: 404 ## Response 422 fields (application/json): - `errorCode` (integer) Example: 1102 - `errorMessage` (string) Example: "[0401-1102]: Unprocessable Entity. The property `coupon_code` is required" - `statusCode` (integer) Example: 422 - `transactionId` (string) Example: "x-x-x-x-transactionId-mock-x-x-x"