Add Discount
Testing
Testing Env
https://www.testecommerce.vodoerp.com
Testing Env
https://www.testecommerce.vodoerp.com
POST
/api/v1/discounts
Last modified:2025-05-18 15:27:08
Key | Value | Description | Type |
---|---|---|---|
apikey | 5f28583f26a1a | API key for authentication; contact support to obtain. Required | string |
apiconnection | appmobile | Connection type; contact support to obtain. Required | string |
secure-business-key | 4765066450c0bd66325.48403130 | Business-specific key; contact support for valid values. Required | string |
userToken | 09119b2691afaa567bc1d46c829ebd41193c8545191146cc5df791681a792ad9 | (Get user token from https://testaccounts.vodoerp.com/api/login or https://accounts.vodoerp.com/api/login ) Required | string |
Key | Value | Description | Type |
---|---|---|---|
code | DISCOUNT845454550 | Unique discount code. Required | string |
reward | 50 | Discount value (e.g., percentage or fixed). Required | integer |
type | 2 | Discount type (e.g., 1 for fixed, 2 for percentage). Required | integer |
allowed_usage | 100 | Maximum usage limit. Optional | integer |
description | خصم 50% على جميع المنتجات | Discount description. Optional | string |
status | 1 | Status: 1 (active), 0 (inactive). | integer |
login_required | 1 | Login required: 1 (yes), 0 (no). Optional | integer |
start_date | 2025-02-01 | Discount start date. Optional | string |
end_date | 2025-03-01 | Discount end date. Optional | string |
customer_categories | [10, 15] | Applicable customer category IDs. Optional | array |
customer_status | 1 | Customer status (e.g., 1 for active). Optional | integer |
customer_login_start_date | 2025-01-01 | Customer login start date filter. Optional | string |
customer_login_end_date | 2025-01-31 | Customer login end date filter. Optional | string |
countries | [78] | Applicable country IDs. Optional | array |
cities | [5, 7, 9] | Applicable city IDs. Optional | array |
employees | [5, 9] | Applicable employee IDs. Optional | array |
job_positions | [7, 3] | Applicable job position IDs. Optional | array |
branches | [2, 4] | Applicable branch IDs. Optional | array |
platforms | [1, 2] | Applicable platforms (e.g., 1 for web). Optional | array |
devices | [1] | Applicable devices (e.g., 1 for mobile). Optional | array |
min_cart_value | 100 | Minimum cart value for discount. Optional | integer |
products | (array) | List of applicable products. Optional | array |
products[].product_id | 2204 | Product ID. Optional | integer |
products[].unit_id | 7 | Unit ID for product. Optional | integer |
products[].attribute_ids | [4, 8, 55] | Attribute IDs for product. Optional | array |
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://www.testecommerce.vodoerp.com/api/v1/discounts' \
--header 'apikey: 5f28583f26a1a' \
--header 'apiconnection: appmobile' \
--header 'secure-business-key: 4765066450c0bd66325.48403130' \
--header 'userToken: 09119b2691afaa567bc1d46c829ebd41193c8545191146cc5df791681a792ad9' \
--header 'Content-Type: application/json' \
--data-raw '{
"code": "DISCOUNT845454550",
"reward": 50,
"type": 2,
"allowed_usage": 100,
"description": "خصم 50% على جميع المنتجات",
"status": 1,
"login_required": 1,
"start_date": "2025-02-01",
"end_date": "2025-03-01",
"customer_categories": [10, 15],
"customer_status": 1,
"customer_login_start_date": "2025-01-01",
"customer_login_end_date": "2025-01-31",
"countries": [78],
"cities": [5, 7, 9],
"employees": [5,9],
"job_positions": [7,3],
"branches": [2, 4],
"platforms": [1,2],
"devices": [1],
"min_cart_value": 100,
"products": [
{
"product_id": 2204,
"unit_id": 7,
"attribute_ids": [4, 8, 55]
},
{
"product_id": 2205,
"unit_id": 8,
"attribute_ids": [5, 9, 56]
}
]
}'
Response Response Example
Add Discount
{
"status": true,
"message": "Discount created successfully",
"data": {
"business_id": 259,
"code": "DISCOUNT845454550",
"reward": 50,
"type": 2,
"allowed_usage": 100,
"description": "خصم 50% على جميع المنتجات",
"status": 1,
"login_required": 1,
"start_date": "2025-01-31T21:00:00.000000Z",
"end_date": "2025-02-28T21:00:00.000000Z",
"employees": [
5,
9
],
"job_positions": [
7,
3
],
"countries": [
78
],
"cities": [
5,
7,
9
],
"platforms": [
1,
2
],
"devices": [
1
],
"min_cart_value": 100,
"customer_categories": [
10,
15
],
"customer_status": 1,
"customer_login_start_date": "2024-12-31T21:00:00.000000Z",
"customer_login_end_date": "2025-01-30T21:00:00.000000Z",
"branches": [
2,
4
],
"updated_at": "2025-03-24T14:59:04.000000Z",
"created_at": "2025-03-24T14:59:04.000000Z",
"id": 14
}
}
Request
Header Params
apikey
string
required
Example:
5f28583f26a1a
apiconnection
string
required
Example:
appmobile
secure-business-key
string
required
728106399db2b289783.89154521
2680667168f2f8a68f6.12561200
140356399db2b2c32f0.25237063
96701678e330f31f768.22400604
14807664478836358b0.31329842
Example:
{{secure_business_key}}
userToken
string
required
https://testaccounts.vodoerp.com/api/login
or
https://accounts.vodoerp.com/api/login
Example:
09119b2691afaa567bc1d46c829ebd41193c8545191146cc5df791681a792ad9
Body Params application/json