LianaCommerce REST API

Discounts

Serverhttps://shop.example.com/api/v1

Set customer role discounts for categories, products, variations or the whole shop. These endpoints only write: the API can't read or delete discounts.


Set category discounts

POST
https://shop.example.com/api/v1
/discounts/categories

Sets the discount percentage that customers in the given roles get on the products of a category. Send an array; each element creates or updates one discount per role in role_ids. Fields you omit keep their stored values (a new discount has no dates); an explicit null removes a date or sets the percentage to 0. If several elements set the same category and role, the last one wins. An unknown or deleted category_id returns 400 and saves nothing. The API can't read or delete discounts; to end one, set ends.

Set category discounts › Request Body

category_id
​integer · int64 · required

The ID of an existing, not deleted category.

Example: 41
role_ids
​integer[] · minItems: 1 · required

The IDs of the customer roles the discount is for. Each ID must exist, otherwise the request returns 400. The element sets one discount per role.

Example: [3,4]
discount_percent
​DiscountPercentInput · min: 0 · max: 99.99 · required

The discount percentage. Must be at least 0 and below 100 after rounding to two decimals, otherwise 400. null means 0.

Example: 15

When the discount starts, as an ISO 8601 date or date-time, read as the shop's local time (an offset is ignored). null removes the start date.

Example: 2026-12-01T00:00:00

When the discount ends, in the same format as starts. null removes the end date.

Example: 2026-12-31T23:59:59

Set category discounts › Responses

The discounts as stored.

href
​string

The URL of the request.

Example: https://shop.example.com/api/v1/products
​object[]

One item per category and role, sorted by category ID and role ID, highest first.

​Meta

Set role discounts

POST
https://shop.example.com/api/v1
/discounts/roles

Sets the shop-wide discount percentage of the given customer roles. Send an array; each element updates every role in role_ids. starts and ends limit when the discount applies; they keep their stored values if you omit them, and an explicit null removes a date. If several elements set the same role, the last one wins. An unknown role ID returns 400 and saves nothing.

Set role discounts › Request Body

role_ids
​integer[] · minItems: 1 · required

The IDs of the customer roles the discount is for. Each ID must exist, otherwise the request returns 400. The element sets one discount per role.

Example: [3,4]
discount_percent
​DiscountPercentInput · min: 0 · max: 99.99 · required

The discount percentage. Must be at least 0 and below 100 after rounding to two decimals, otherwise 400. null means 0.

Example: 15

When the discount starts, as an ISO 8601 date or date-time, read as the shop's local time (an offset is ignored). null removes the start date.

Example: 2026-12-01T00:00:00

When the discount ends, in the same format as starts. null removes the end date.

Example: 2026-12-31T23:59:59

Set role discounts › Responses

The discounts as stored.

href
​string

The URL of the request.

Example: https://shop.example.com/api/v1/products
​object[]

One item per role, sorted by role ID, highest first.

​Meta

Set product discounts

POST
https://shop.example.com/api/v1
/discounts/products

Sets the fixed price or discount percentage, or both, that customers in the given roles get on a product. Send an array; each element creates or updates one discount per role in role_ids. Fields you omit keep their stored values (a new discount has 0 prices and no dates); an explicit null removes a date or sets a price field to 0. If several elements set the same product and role, the last one wins. An unknown or deleted product_id returns 400 and saves nothing. The API can't read or delete discounts; to end one, set ends.

Set product discounts › Request Body

Send at least one of `fixed_price` and `discount_percent`.
product_id
​integer · int64 · required

The ID of an existing, not deleted product.

Example: 1203
role_ids
​integer[] · minItems: 1 · required

The IDs of the customer roles the discount is for. Each ID must exist, otherwise the request returns 400. The element sets one discount per role.

Example: [3,4]
fixed_price
​FixedPriceInput · min: 0

A fixed price for the role, entered like the shop's product prices (with or without VAT, depending on the shop's settings). 0 or null means no fixed price. A negative value returns 400.

Example: 19.9
discount_percent
​DiscountPercentInput · min: 0 · max: 99.99

The discount percentage. Must be at least 0 and below 100 after rounding to two decimals, otherwise 400. null means 0.

Example: 15

When the discount starts, as an ISO 8601 date or date-time, read as the shop's local time (an offset is ignored). null removes the start date.

Example: 2026-12-01T00:00:00

When the discount ends, in the same format as starts. null removes the end date.

Example: 2026-12-31T23:59:59

Set product discounts › Responses

The discounts as stored.

href
​string

The URL of the request.

Example: https://shop.example.com/api/v1/products
​object[]

One item per product and role, sorted by product ID and role ID, highest first.

​Meta

Set variation discounts

POST
https://shop.example.com/api/v1
/discounts/variations

Sets the fixed price or discount percentage, or both, that customers in the given roles get on a variation. Send an array; each element creates or updates one discount per role in role_ids. Fields you omit keep their stored values (a new discount has 0 prices and no dates); an explicit null removes a date or sets a price field to 0. If several elements set the same variation and role, the last one wins. An unknown or deleted variation_id returns 400 and saves nothing. The API can't read or delete discounts; to end one, set ends.

Set variation discounts › Request Body

Send at least one of `fixed_price` and `discount_percent`.
variation_id
​integer · int64 · required

The ID of an existing, not deleted variation.

Example: 5521
role_ids
​integer[] · minItems: 1 · required

The IDs of the customer roles the discount is for. Each ID must exist, otherwise the request returns 400. The element sets one discount per role.

Example: [3,4]
fixed_price
​FixedPriceInput · min: 0

A fixed price for the role, entered like the shop's product prices (with or without VAT, depending on the shop's settings). 0 or null means no fixed price. A negative value returns 400.

Example: 19.9
discount_percent
​DiscountPercentInput · min: 0 · max: 99.99

The discount percentage. Must be at least 0 and below 100 after rounding to two decimals, otherwise 400. null means 0.

Example: 15

When the discount starts, as an ISO 8601 date or date-time, read as the shop's local time (an offset is ignored). null removes the start date.

Example: 2026-12-01T00:00:00

When the discount ends, in the same format as starts. null removes the end date.

Example: 2026-12-31T23:59:59

Set variation discounts › Responses

The discounts as stored.

href
​string

The URL of the request.

Example: https://shop.example.com/api/v1/products
​object[]

One item per variation and role, sorted by variation ID and role ID, highest first.

​Meta