Skip to main content

Discount Rule API (v0)

Download OpenAPI specification:Download

Represents a discount rule defining a type of discount. For example, shipping is free when the order value reaches $70.

A discount rule is not an applicable discount, but it is needed to create a coupon definition leading to a coupon. Using the coupon applies the discount. For more information, see the coupons guide.

Create discount rule

Creates a discount rule.

Important: Ensure that you specify the value of the amount property correctly, according to the specified currency. For example, if the currency is specified as USD and the product price (amount) has more than 2 decimal places, it is considered as invalid by the platform.

For more information, see pricing dependencies on currency.

Authorizations:
newStoreAccessToken
Request Body schema: application/json
One of
label
required
string non-empty

Unique name of the discount rule. The value is trimmed before it is stored.

description
string non-empty

Description of the discount rule. The value is trimmed before it is stored.

scope
required
string
Enum: "order" "item" "shipping"

Scope of the discount to be applied on, the whole order value, individual item's value or the shipping costs. In case of item scope at least one item or category identifier has to be specified in the list of items or categories.

currency
required
string = 3 characters

The currency code of the amount property (in case of a fixed discount) as well as the minimum_order_amount. The currency of the discount rule and the order that it should be applied on must match.

priority
integer >= 0
Default: 0

Defines the priority in which the discount rules are applied. Higher values mean higher priority.

minimum_order_amount
number >= 0

Minimum order total value in the given currency before the discount rule can be applied.

shipping_price_limit
number >= 0

Shipping price limit, i.e. do not apply this shipping discount rule to shipping options with prices higher than this limit

type
required
string
Value: "fixed"
amount
required
number >= 0

Fixed amount in the given currency to be applied

items
Array of strings

A list of product IDs. Each item included in this list is discounted by the provided amount upon checkout. The list is only taken into account for discount rules with scope item

categories
Array of strings

A list of category identifiers. Each item belonging to a category specified in this list is discounted by the provided amount upon checkout. The list is only taken into account for discount rules with scope item

Responses

Request samples

Content type
application/json
{
  • "discount_rule_fixed": {
    },
  • "discount_rule_order": {
    },
  • "discount_rule_shipping": {
    }
}

Response samples

Content type
application/json
{
  • "discount_rule": {
    }
}

List discount rules

Retrieves a list of discount rules.

Authorizations:
newStoreAccessToken
query Parameters
labels
Array of strings <= 20 items unique

List of labels to filter discount rules.

advanced_search
string

Any non-empty value enables advanced search with sorting, filtering and full-text queries. If used, fields items and categories will be excluded from discount rule item in the response.

Responses

Response samples

Content type
application/json
{
  • "discount_rule_list": {
    }
}

Get discount rule

Retrieves the discount rule with the given ID.

Authorizations:
newStoreAccessToken
path Parameters
id
required
string

The identifier of the discount rule. Use the List discount rules method to retrieve the ID.

Responses

Response samples

Content type
application/json
{
  • "discount_rule": "./examples/example_discount_rule_response.yaml"
}

Update discount rule

Updates certain fields in the specified discount rule.

Important: Ensure that you specify the value of the amount property correctly, according to the specified currency. For example, if the currency is specified as USD and the product price (amount) has more than 2 decimal places, it is considered as invalid by the platform.

For more information, see pricing dependencies on currency.

Authorizations:
newStoreAccessToken
path Parameters
id
required
string

The identifier of the discount rule. Use the List discount rules method to retrieve the ID.

Request Body schema: application/json
label
string non-empty

Unique name of the discount rule. The value is trimmed before it is stored.

description
string non-empty

Description of the discount rule. The value is trimmed before it is stored.

scope
string
Enum: "order" "item" "shipping"

Scope of the discount to be applied on, the whole order value, individual item's value or the shipping costs. In case of item scope at least one item or category identifier has to be specified in the list of items or categories.

type
string
Enum: "fixed" "percentage"
amount
number >= 0

Fixed amount in the given currency or percentage to be applied

priority
integer >= 0
Default: 0

Defines the priority in which the discount rules are applied. Higher values mean higher priority.

minimum_order_amount
number >= 0

Minimum order total value in the given currency before the discount rule can be applied.

shipping_price_limit
number >= 0

Shipping price limit, i.e. do not apply this shipping discount rule to shipping options with prices higher than this limit

items
Array of strings

A list of product IDs. Each item included in this list is discounted by the provided amount upon checkout. The list is only taken into account for discount rules with scope item

categories
Array of strings

A list of category identifiers. Each item belonging to a category specified in this list is discounted by the provided amount upon checkout. The list is only taken into account for discount rules with scope item

currency
string = 3 characters

The currency code of the amount property (in case of a fixed discount) as well as the minimum_order_amount. The currency of the discount rule and the order that it should be applied on must match.

Responses

Request samples

Content type
application/json
{
  • "patch_discount_rule_items": {
    },
  • "patch_discount_rule_min_amount": {
    }
}

Response samples

Content type
application/json
{
  • "discount_rule": {
    }
}

Delete discount rule

Deletes discount rule with the given ID.

Authorizations:
newStoreAccessToken
path Parameters
id
required
string

The identifier of the discount rule. Use the List discount rules method to retrieve the ID.

Responses