๐๏ธ Promotion Codes
Promotion code creation and validation endpoints. 6 endpoints available.
๐ฏ Quick Stats
- Total Endpoints: 6
- Base URL:
https://api.market.decenctype.com - Authentication: Bearer Token / API Key
๐ Methods
- ๐ POST: 2 endpoints
- ๐ GET: 2 endpoints
- โ๏ธ PUT: 1 endpoints
- ๐๏ธ DELETE: 1 endpoints
๐ Authentication
All endpoints in this section use the same authentication methods. Choose one:
๐ Bearer Token (Recommended)
For user session authentication
Add to request headers:
Authorization: Bearer YOUR_TOKEN๐ง API Key
For server-side authentication
Add to request headers:
X-API-KEY: YOUR_API_KEYโ ๏ธ Important: Do not use both authentication methods simultaneously in the same request.
๐ Endpoints Overview
| Method | Endpoint | Description |
|---|---|---|
๐ POST | /promotion-code | Create promotion code |
๐ GET | /promotion-code | Get promotion code list |
๐ GET | /promotion-code/{code} | Get promotion code by code |
โ๏ธ PUT | /promotion-code/{code} | Update promotion code |
๐๏ธ DELETE | /promotion-code/{code} | Delete promotion code |
๐ POST | /promotion-code/validate | Validate promotion code |
๐ Detailed Documentation
Create promotion code
/promotion-codehttps://api.market.decenctype.com/promotion-code๐ Request Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
code | string | โ | ไฟ้ไปฃ็ |
discountAmount | number | โ | Discount amount |
currency | string | โ | ่ดงๅธ (้ป่ฎค: USD) |
maxUsage | number | โ | Maximum usage limit (้ป่ฎค: 1) |
status | string (active, inactive, expired) | โ | Status (้ป่ฎค: active) |
expirationDate | string | โ | Expiration date |
agentId | string | โ | Agent ID |
merchantId | string | โ | Merchant ID |
Description: Create promotion code
Operation ID: createPromotionCode
Response Status:
- โ 201: Promotion code created successfully
- โ 400: Bad request
๐ Response Examples
1{2 "id": "example-id",3 "code": "example-code",4 "discountAmount": 1,5 "userId": "example-id",6 "agentId": "example-id",7 "merchantId": "example-id",8 "currency": "example-currency",9 "usageCount": 1,10 "maxUsage": 1,11 "status": "active",12 "expirationDate": "2024-01-01T12:00:00Z",13 "createdAt": "2024-01-01T12:00:00Z",14 "updatedAt": "2024-01-01T12:00:00Z",15 "user": "example-user"16}๐ Example Request
curl -X POST "https://api.market.decenctype.com/promotion-code" \\
-H "Authorization: Bearer YOUR_TOKEN" \\
-H "Content-Type: application/json" \\
-d '{
"code": "example-code",
"discountAmount": 1,
"currency": "USD",
"maxUsage": 1,
"status": "active",
"expirationDate": "example-expirationDate",
"agentId": "example-id",
"merchantId": "example-id"
}'Get promotion code list
/promotion-codehttps://api.market.decenctype.com/promotion-code๐ Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
page | number | โ | Page number |
pageSize | number | โ | Page size |
status | string | โ | Filter by status |
Description: Get promotion code list
Operation ID: getPromotionCodeList
Response Status:
- โ 200: Promotion code list
๐ Response Examples
1{2 "items": [3 {4 "id": "example-id",5 "code": "example-code",6 "discountAmount": 1,7 "userId": "example-id",8 "agentId": "example-id",9 "merchantId": "example-id",10 "currency": "example-currency",11 "usageCount": 1,12 "maxUsage": 1,13 "status": "active",14 "expirationDate": "2024-01-01T12:00:00Z",15 "createdAt": "2024-01-01T12:00:00Z",16 "updatedAt": "2024-01-01T12:00:00Z",17 "user": "example-user"18 }19 ],20 "meta": "example-meta"21}๐ Example Request
curl -X GET "https://api.market.decenctype.com/promotion-code" \\
-H "Authorization: Bearer YOUR_TOKEN" \\
-H "Content-Type: application/json"Get promotion code by code
/promotion-code/{code}https://api.market.decenctype.com/promotion-code/{code}๐ฏ Path Parameters
code(string) - โ Required: Promotion code
Description: Get promotion code by code
Operation ID: getPromotionCodeByCode
Response Status:
- โ 200: Promotion code details
- โ 404: Promotion code not found
๐ Response Examples
1{2 "id": "example-id",3 "code": "example-code",4 "discountAmount": 1,5 "userId": "example-id",6 "agentId": "example-id",7 "merchantId": "example-id",8 "currency": "example-currency",9 "usageCount": 1,10 "maxUsage": 1,11 "status": "active",12 "expirationDate": "2024-01-01T12:00:00Z",13 "createdAt": "2024-01-01T12:00:00Z",14 "updatedAt": "2024-01-01T12:00:00Z",15 "user": "example-user"16}๐ Example Request
curl -X GET "https://api.market.decenctype.com/promotion-code/example-code" \\
-H "Authorization: Bearer YOUR_TOKEN" \\
-H "Content-Type: application/json"Update promotion code
/promotion-code/{code}https://api.market.decenctype.com/promotion-code/{code}๐ฏ Path Parameters
code(string) - โ Required: Promotion code
๐ Request Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
discountAmount | number | โ | Discount amount |
currency | string | โ | ่ดงๅธ |
maxUsage | number | โ | Maximum usage limit |
status | string (active, inactive, expired) | โ | Status |
expirationDate | string | โ | Expiration date |
agentId | string | โ | Agent ID |
merchantId | string | โ | Merchant ID |
Description: Update promotion code
Operation ID: updatePromotionCode
Response Status:
- โ 200: Promotion code updated successfully
- โ 404: Promotion code not found
๐ Response Examples
1{2 "id": "example-id",3 "code": "example-code",4 "discountAmount": 1,5 "userId": "example-id",6 "agentId": "example-id",7 "merchantId": "example-id",8 "currency": "example-currency",9 "usageCount": 1,10 "maxUsage": 1,11 "status": "active",12 "expirationDate": "2024-01-01T12:00:00Z",13 "createdAt": "2024-01-01T12:00:00Z",14 "updatedAt": "2024-01-01T12:00:00Z",15 "user": "example-user"16}๐ Example Request
curl -X PUT "https://api.market.decenctype.com/promotion-code/example-code" \\
-H "Authorization: Bearer YOUR_TOKEN" \\
-H "Content-Type: application/json" \\
-d '{
"discountAmount": 1,
"currency": "example-currency",
"maxUsage": 1,
"status": "active",
"expirationDate": "example-expirationDate",
"agentId": "example-id",
"merchantId": "example-id"
}'Delete promotion code
/promotion-code/{code}https://api.market.decenctype.com/promotion-code/{code}๐ฏ Path Parameters
code(string) - โ Required: Promotion code
Description: Delete promotion code
Operation ID: deletePromotionCode
Response Status:
- โ 200: Promotion code deleted successfully
- โ 404: Promotion code not found
๐ Example Request
curl -X DELETE "https://api.market.decenctype.com/promotion-code/example-code" \\
-H "Authorization: Bearer YOUR_TOKEN" \\
-H "Content-Type: application/json"Validate promotion code
/promotion-code/validatehttps://api.market.decenctype.com/promotion-code/validate๐ Request Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
code | string | โ | ไฟ้ไปฃ็ |
orderAmount | number | โ | Order amount |
Description: Validate promotion code
Operation ID: validatePromotionCode
Response Status:
- โ 200: Promotion code validation result
- โ 201: Success
๐ Response Examples
1{2 "valid": false,3 "discountAmount": 0,4 "promotionCode": "example-promotionCode",5 "error": "Promotion code not found"6}๐ Example Request
curl -X POST "https://api.market.decenctype.com/promotion-code/validate" \\
-H "Authorization: Bearer YOUR_TOKEN" \\
-H "Content-Type: application/json" \\
-d '{
"code": "example-code",
"orderAmount": 1
}'