Discount
INFO
Every response arrives in the shared envelope — code, message, messages, status_code, time — with the payload in data. The tables below describe what is inside data.
POST /discount/create
This method allows adding discount into the account.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | |
organization_ids | string[] | Yes | |
auto_attach | boolean | Yes | |
is_manual | boolean | Yes | |
state | string | Yes | One of: not_started, active, expired |
live_type | string | Yes | One of: forever, duration |
assign_type | string | Yes | One of: all, specific |
apply_type | string | Yes | One of: percent, cash |
value | number | Yes | |
currency_id | string | Yes | |
starting_date | string | Yes | |
ending_date | string | Yes | |
is_all_categories | boolean | Yes | |
category_ids | string[] | No | |
nested_category_ids | string[] | Yes | |
item_added_ids | string[] | Yes | Product ids |
{
"name": "string",
"organization_ids": [
"string"
],
"auto_attach": false,
"is_manual": false,
"state": "not_started",
"live_type": "forever",
"assign_type": "all",
"apply_type": "percent",
"value": 0,
"currency_id": "string",
"starting_date": "string",
"ending_date": "string",
"is_all_categories": false,
"category_ids": [
"string"
],
"nested_category_ids": [
"string"
],
"item_added_ids": [
"string"
]
}Response
| Field | Type | Description |
|---|---|---|
_id | string | id of discount |
name | string | |
organization_ids | string[] | |
auto_attach | boolean | |
is_manual | boolean | |
state | string | One of: not_started, active, expired |
live_type | string | One of: forever, duration |
assign_type | string | One of: all, specific |
apply_type | string | One of: percent, cash |
value | number | |
currency_id | string | |
starting_date | string | |
ending_date | string | |
is_all_categories | boolean | |
category_ids | string[] | |
nested_category_ids | string[] | |
item_added_ids | string[] |
{
"code": 0,
"message": "Success",
"status_code": 200,
"data": {
"_id": "string",
"name": "string",
"organization_ids": [
"string"
],
"auto_attach": false,
"is_manual": false,
"state": "not_started",
"live_type": "forever",
"assign_type": "all",
"apply_type": "percent",
"value": 0,
"currency_id": "string",
"starting_date": "string",
"ending_date": "string",
"is_all_categories": false,
"category_ids": [
"string"
],
"nested_category_ids": [
"string"
],
"item_added_ids": [
"string"
]
},
"time": "2025-05-01T12:00:00Z"
}PUT /discount/update
This method allows updating discount in the account.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | |
organization_ids | string[] | Yes | |
auto_attach | boolean | Yes | |
is_manual | boolean | Yes | |
state | string | Yes | One of: not_started, active, expired |
live_type | string | Yes | One of: forever, duration |
assign_type | string | Yes | One of: all, specific |
apply_type | string | Yes | One of: percent, cash |
value | number | Yes | |
currency_id | string | Yes | |
starting_date | string | Yes | |
ending_date | string | Yes | |
is_all_categories | boolean | Yes | |
category_ids | string[] | No | |
nested_category_ids | string[] | Yes | |
item_added_ids | string[] | Yes | Product ids |
_id | string | Yes | id of customer |
{
"name": "string",
"organization_ids": [
"string"
],
"auto_attach": false,
"is_manual": false,
"state": "not_started",
"live_type": "forever",
"assign_type": "all",
"apply_type": "percent",
"value": 0,
"currency_id": "string",
"starting_date": "string",
"ending_date": "string",
"is_all_categories": false,
"category_ids": [
"string"
],
"nested_category_ids": [
"string"
],
"item_added_ids": [
"string"
],
"_id": "string"
}Response
Same response shape as POST /discount/create.
DELETE /discount/delete/{id}
Delete a discount
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes |
Request body
No request body.
Response
{
"code": 0,
"message": "Success",
"status_code": 200,
"data": "ok",
"time": "2025-05-01T12:00:00Z"
}GET /discount/get-by-id/{id}
Get discount using its _id
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes |
Request body
No request body.
Response
Same response shape as POST /discount/create.
POST /discount/get-paging
Get discounts by paging
Request body
| Field | Type | Required | Description |
|---|---|---|---|
page | number | Yes | Default: 1 |
limit | number | Yes | Default: 20 |
apply_type | string | No | |
states | string | No | |
search | string | No | |
currency_id | string | No | |
is_expired | boolean | No | |
organization_ids | string[] | No |
{
"page": 1,
"limit": 20,
"apply_type": "string",
"states": "string",
"search": "string",
"currency_id": "string",
"is_expired": false,
"organization_ids": [
"string"
]
}Response
data.total is the total number of records and data.data[] holds the current page. The table below describes one record.
| Field | Type | Description |
|---|---|---|
_id | string | id of discount |
name | string | |
organization_ids | string[] | |
auto_attach | boolean | |
is_manual | boolean | |
state | string | One of: not_started, active, expired |
live_type | string | One of: forever, duration |
assign_type | string | One of: all, specific |
apply_type | string | One of: percent, cash |
value | number | |
currency_id | string | |
starting_date | string | |
ending_date | string | |
is_all_categories | boolean | |
category_ids | string[] | |
nested_category_ids | string[] | |
item_added_ids | string[] |
{
"code": 0,
"message": "Success",
"status_code": 200,
"data": {
"total": 0,
"data": [
{
"_id": "string",
"name": "string",
"organization_ids": [
"string"
],
"auto_attach": false,
"is_manual": false,
"state": "not_started",
"live_type": "forever",
"assign_type": "all",
"apply_type": "percent",
"value": 0,
"currency_id": "string",
"starting_date": "string",
"ending_date": "string",
"is_all_categories": false,
"category_ids": [
"string"
],
"nested_category_ids": [
"string"
],
"item_added_ids": [
"string"
]
}
]
},
"time": "2025-05-01T12:00:00Z"
}POST /discount/get-all
Get all discounts
Request body
| Field | Type | Required | Description |
|---|---|---|---|
apply_type | string | No | One of: percent, cash |
currency_id | string | No | |
organization_ids | string[] | No | |
is_expired | boolean | No | |
states | string[] | No |
{
"apply_type": "percent",
"currency_id": "64e5b499189503e999999999",
"organization_ids": [
"64e5b499189503e999999999"
],
"is_expired": false,
"states": [
"active"
]
}Response
{
"code": 0,
"message": "Success",
"status_code": 200,
"data": [
{
"_id": "string",
"name": "string",
"organization_ids": [
"string"
],
"auto_attach": false,
"is_manual": false,
"state": "not_started",
"live_type": "forever",
"assign_type": "all",
"apply_type": "percent",
"value": 0,
"currency_id": "string",
"starting_date": "string",
"ending_date": "string",
"is_all_categories": false,
"category_ids": [
"string"
],
"nested_category_ids": [
"string"
],
"item_added_ids": [
"string"
]
}
],
"time": "2025-05-01T12:00:00Z"
}GET /discount/get-deleted
Get deleted discount ids
Query parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
deleted_at | string | Yes |
Request body
No request body.
Response
{
"code": 0,
"message": "Success",
"status_code": 200,
"data": [
"string"
],
"time": "2025-05-01T12:00:00Z"
}This page is generated from the OpenAPI spec.