Promotions

Method for retrieving products and the types of discounts that apply to them.

Handling promotional products for m = n promotions

Note

The promotion does not work with catch-weight products.

Do not pass "price": 0 value in the request body when creating a Yango Deli order. Spread the total cost of promotional products among all units of that product. If the resulting spread price has more than 2 decimal places, the service splits the product quantity into two positions with different prices, keeping the total order amount unchanged.

Here’s the logic with an example:

The user’s order contains: 3 cheese sticks at 100 ZMK each. A “3 for the price of 2” promotion is applied. When creating the order, Yango Deli will pass to the Partner

"items":
[
    {
        "id": "11432741",
        "quantity": 2,
        "price": 66.67,
        "name": “Cheese sticks"
    },
    {
        "id": "11432741",
        "quantity": 1,
        "price": 66.66,
        "name": “Cheese sticks"
    }
]

Note that Yango Deli does not apply promotions to new products that were added to the order as replacements for unavailable items. Also, when removing products from an order, “free” products are removed first.

For example, a user placed an order for 6 units of a product with a “2 for the price of 1” promotion. Price of one product is 50 rubles.
[50] [0] [50] [0]

When the Partner removes 2 units of the product, Yango Deli will apply them first to all bonus products.
[50] [0] [50] [0]

In the response body of the GET /order/{orderId} method, it’s not necessary to pass promotional products as separate positions as in the example above. It’s sufficient to pass the total quantity of the product and its full price.

Request

GET

/nomenclature/{placeId}/discounts

Path parameters

Name

Description

placeId*

Type: string

Unique store identifier in Partner’s system.

Headers

Name

Description

Authorization*

Type: string

Token received in response to the /security/oauth/token request

Responses

200 OK

Discounts retrieved successfully.

Body

application/json
{
    "place_id": "1000",
    "discounts": [
        {
            "type": "product_discount",
            "conditions": {
                "discount_value": 100,
                "bundle": 3
            },
            "schedule": {
                "from": "10-11-2021 00:00:00",
                "to": "11-11-2021 00:00:00"
            },
            "origin_ids": [
                "948472729",
                "8365776837"
            ]
        },
        {
            "type": "price_discount",
            "money_value": {
                "value_type": "fraction",
                "value": "100.00",
                "maximum_discount": "1000.00"
            },
            "schedule": {
                "from": "10-11-2021 00:00:00",
                "to": "11-11-2021 00:00:00"
            },
            "origin_ids": [
                "948472729",
                "8365776837"
            ]
        }
    ]
}

Name

Description

discounts*

Type: (ProductDiscount
or PriceDiscount)[]

List of discounts
Discount of type ProductDiscount or PriceDiscount.

place_id*

Type: string

Store identifier in the partner’s system.

Example: 1000

ProductDiscount

Product-type discount “3 products for the price of 2”.

Name

Description

conditions*

Type: Conditions

For “2 for the price of 1” the discount_value field will be 100, bundle field will be 2
For “3 for the price of 2” the discount_value field will be 100, bundle field will be 3
For “4 for the price of 2” the discount_value field will be 200, bundle field will be 4

origin_ids*

Type: string[]

List of product identifiers participating in the promotion.

Example: 948472729,8365776837

schedule*

Type: Schedule

Discount schedule, currently we only support
UTC start and end time in DD-MM-YYYY HH:MM:SS format.
If not provided, the current day is used as the schedule.

type*

Type: string

Object schema discriminator; for ProductDiscount it equals product_discount.

Example: product_discount

PriceDiscount

Absolute or percentage product discount.

Name

Description

money_value*

Type: FractionValueWithMaximum
or AbsoluteValue

Discount value.

origin_ids*

Type: string[]

List containing identifiers of products that fall under the discount.

Example: 948472729,8365776837

schedule*

Type: Schedule

Discount schedule, currently we only support
UTC start and end time in DD-MM-YYYY HH:MM:SS format.
If not provided, the current day is used as the schedule.

type*

Type: string

Object schema discriminator; for PriceDiscount it equals price_discount.

Example: price_discount

Conditions

For “2 for the price of 1” the discount_value field will be 100, bundle field will be 2
For “3 for the price of 2” the discount_value field will be 100, bundle field will be 3
For “4 for the price of 2” the discount_value field will be 200, bundle field will be 4

Name

Description

bundle*

Type: integer

Number of products required to trigger the discount.

Example: 3

discount_value*

Type: integer

How many products the user gets as a gift * 100%.

Example: 100

Schedule

Discount schedule, currently we only support
UTC start and end time in DD-MM-YYYY HH:MM:SS format.
If not provided, the current day is used as the schedule.

Name

Description

from

Type: string

Example: 10-11-2021 00:00:00

to

Type: string

Example: 11-11-2021 00:00:00

FractionValueWithMaximum

Percentage discount with limitation.

Name

Description

value*

Type: string

Discount value (percentage).

Example: 100.00

Min length: 1

value_type*

Type: string

Value type. Object schema discriminator; for FractionValueWithMaximum it equals fraction.

Example: fraction

maximum_discount

Type: string

Maximum absolute discount value

Example: 1000.00

Min length: 1

AbsoluteValue

Absolute discount value.

Name

Description

value*

Type: string

Discount value

Example: 1000.00

Min length: 1

value_type*

Type: string

Value type. Object schema discriminator; for AbsoluteValue it equals absolute.

Example: absolute

400 Bad Request

Request error. The response is expected to contain an array with an object from the error list.

Body

application/json
[
    {
        "code": 400,
        "description": "Description of error"
    }
]

ErrorItem[]

ErrorItem

Name

Description

code*

Type: integer

Numeric error code agreed with Yango Deli.

Example: 400

description*

Type: string

Error description

Example: Description of error

401 Unauthorized

Authorisation failed.

Body

application/json
{
    "reason": "Access token has been expired. You should request a new one"
}

Name

Description

reason*

Type: string

The reason why authorisation failed.

Example: Access token has been expired. You should request a new one

404 Not Found

Resource not found. The response is expected to contain an array with an object from the error list.

Body

application/json
[
    {
        "code": 400,
        "description": "Description of error"
    }
]

ErrorItem[]

500 Internal Server Error

Internal server errors. The response is expected to contain an array with an object from the error list.

Body

application/json
[
    {
        "code": 400,
        "description": "Description of error"
    }
]

ErrorItem[]

No longer supported, please use an alternative and newer version.