Xsolla-logo

Создание акции с промокодамиServer-sideAdmin

post/v2/project/{project_id}/admin/promocode

Создает акцию с промокодами.

SecuritybasicAuth
Request
path Parameters
project_id
required
integer

ID проекта. Вы можете найти этот параметр в Личном кабинете рядом с названием проекта.

Example: 44056
Request Body schema: application/json
external_id
required
string
Default: "coupon_external_id"

Уникальный ID акции. external_id может содержать только строчные латинские буквы, цифры, точки, тире и подчеркивания.

required
object
Default: {"de-DE":"Gutscheintitel","en-US":"Coupon title"}

Название акции. Данный параметр должен содержать пары ключ/значение, где ключ — это локаль в формате "^[a-z]{2}-[A-Z]{2}$", значение — строка.

property name*
additional property
string
Array of type = string (objects) or Array of type = date (objects) or Array of type = number (objects)

Условия, которые сравниваются со значениями пользовательских атрибутов. Чтобы действие вступило в силу, все условия должны быть выполнены.

One of:

Условия, которые сравниваются со значениями пользовательских атрибутов. Чтобы действие вступило в силу, все условия должны быть выполнены.

[ 1 .. 100 ] items
Array ([ 1 .. 100 ] items)
attribute
required
string [ 1 .. 255 ] characters ^[-_.\\d\\w]+$

Код атрибута пользователя.

operator
required
string

Тип операции, выполняемой по условию. Для типа атрибута string.

Enum: Description
eq

Равно

ne

Не равно

value
required
string <= 255 characters

Значение условия, с которым будет сравниваться значение атрибута пользователя. Тип зависит от типа атрибута.

type
required
string

Тип атрибута пользователя.

Value: "string"
can_be_missing
boolean

Считается ли условие выполненным, если этот атрибут отсутствует в атрибутах пользователя. Передайте true, чтобы показывать товар пользователям, у которых нет этого атрибута. Пользователи у которых атрибут есть, но значение не совпадает с указанным в условии, не увидят товар. false — пользователи у которых атрибут есть, но значение не совпадает с указанным в условии, или атрибута нет, не увидят товар.

Array of objects or null
Array
quantity
number
Default: 1

Количество товара.

sku
string
Default: "elven_shield"

Артикул товара.

date_end
string or null <date-time>
Default: "2020-04-15T18:16:00+05:00"

Дата, когда ваша акция будет завершена. Может быть null. Если date_end равно null, акция будет неограниченна по времени.

date_start
string or null <date-time>
Default: "2020-04-15T18:16:00+05:00"

Дата, когда начнется ваша акция.

object or null
percent
string or null
Default: "10.00"

Процент скидки. Цена корзины будет уменьшена с использованием значения, рассчитанного с использованием этого процента, а затем округлена до 2 знаков после запятой.

Array of objects or null

Список товаров, на которые действует скидка по промокоду.

Array
sku
required
string
Default: "elven_shield"

Артикул товара.

required
object
percent
required
string
Default: "10.00"

Процент скидки.

Цена товара в корзине будет уменьшена с использованием значения, рассчитанного с использованием этого процента, а затем округлена до 2 знаков после запятой.

excluded_promotions
Array of integers

Список акций, которые исключаются при применении этой акции.
Example: [12, 789]

Array of objects or null

Array of objects with conditions that set the price range for applying the promotion to certain items in the cart.
The price of each item in the user's cart is compared with the price range specified in the condition. Bonuses and discounts are applied only to those items in the cart whose price meets the condition.
If you pass this array, set the value of the discounted_items array to null.

Array
operator
required
string

Comparison operator for setting the price range for applying the promotion.

Enum: Description
eq

Равно

ge

Greater or equal

gt

Greater than

le

Less or equal

lt

Less than

ne

Не равно

value
required
string^\\d+(\\.\\d{1,4})?$

Value for determining the price range for applying the promotion.

Array of objects or null

Array of objects with conditions that set the price range for applying the promotion to the entire cart.
The total price of all items in the user's cart is compared with the price range specified in the condition. Bonuses and discounts are applied to all items in the cart if the price of the cart meets the specified condition.
If you pass this array, set the value of the discounted_items array to null.

Array
operator
required
string

Comparison operator for setting the price range for applying the promotion.

Enum: Description
eq

Равно

ge

Greater or equal

gt

Greater than

le

Less or equal

lt

Less than

ne

Не равно

value
required
string^\\d+(\\.\\d{1,4})?$

Value for determining the price range for applying the promotion.

redeem_code_limit
integer or null
Default: 10

Количество погашений по коду.

redeem_total_limit
integer or null
Default: 10

Ограничивает общее количество купонов.

redeem_user_limit
integer or null
Default: 10

Ограничивает общее количество купонов, погашаемых одним пользователем.

Responses
201

Промокод успешно создан.

401

Данные для базовой аутентификации не переданы или ошибочны. Убедитесь, что использовали базовую аутентификацию и проверьте правильность учетных данных.

422

Неверный запрос.

Request samples
application/json
{
  • "attribute_conditions": [
    ],
  • "date_end": "2020-04-25T18:16:00+05:00",
  • "date_start": "2020-04-15T18:16:00+05:00",
  • "discount": {
    },
  • "external_id": "coupon_external_id",
  • "name": {
    },
  • "redeem_code_limit": 1,
  • "redeem_total_limit": 100,
  • "redeem_user_limit": 1
}
Response samples
application/json
{
  • "external_id": "coupon_external_id"
}