Create a discount
Create a discount for a store.
Create a discount for a store. Fixed discounts take an amount in the smallest currency unit (e.g. $10 is 1000); percentage discounts take a whole-number value between 1 and 100. Free-shipping discounts ignore value. Returns the created discount.
API Token authentication
The ID of the store to create the discount for.
store_01J8Z5F8W9K8M4A7B3C2D1E0FGThe discount code customers enter at checkout.
BLACKFRIDAYA human-friendly discount name.
Black FridayThe discount type.
percentagePossible values: For percentage discounts a whole number 1-100; for fixed discounts an amount in the smallest currency unit (e.g. $10 is 1000). Ignored for free_shipping.
20Whether the discount applies to the cart total or to each eligible item.
totalPossible values: When the discount becomes active. A bare date (2026-11-27) anchors to time_zone. Defaults to now when omitted.
2026-01-21T07:35:04.000000ZWhen the discount expires. A bare date runs to the end of that day in time_zone. Never expires when omitted.
2026-02-21T07:35:04.000000ZMaximum number of times the discount can be redeemed.
100Minimum cart value in the smallest currency unit required for the discount to apply.
5000IANA time zone used to interpret starts_at and ends_at.
Europe/VilniusCreated response
Unauthenticated response
Validation error response
Error response
POST /api/ecommerce/v1/stores/{store_id}/discounts HTTP/1.1
Host: developers.hostinger.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 247
{
"code": "BLACKFRIDAY",
"name": "Black Friday",
"type": "percentage",
"value": 20,
"allocation": "total",
"starts_at": "2026-01-21T07:35:04.000000Z",
"ends_at": "2026-02-21T07:35:04.000000Z",
"usage_limit": 100,
"min_cart_value": 5000,
"time_zone": "Europe/Vilnius"
}{
"data": {
"id": "disc_01J8Z5F8W9K8M4A7B3C2D1E0FG",
"code": "BLACKFRIDAY",
"name": "Black Friday",
"type": "percentage",
"value": 20,
"allocation": "total",
"is_disabled": false,
"starts_at": "2026-01-21T07:35:04.000000Z",
"ends_at": null,
"usage_limit": null,
"usage_count": 0
}
}Last updated
Was this helpful?