v1

latestOpenAPI 3.0.3raw.githubusercontent.com2024-10-2916802.4 MB
🛒 Ecommerce

Create coupon

The API allows users with an ADMIN role to create a coupon.

This API endpoint accepts the necessary information for creating a coupon, such as the coupon code, discount amount, expiration date, and any additional conditions.

The endpoint performs authentication and authorization checks to ensure that only users with the ADMIN role can access it.

post/ecommerce/coupons

Request body

namestring
couponCodestring
type'FLAT'
discountValuenumber
minimumCartValuenumber
expiryDatestring date-time
startDatestring date-time

Example request

{
  "name": "Season sale",
  "couponCode": "must be unique like 'GET600'",
  "type": "FLAT",
  "discountValue": 600,
  "minimumCartValue": 700,
  "expiryDate": "2024-06-13T11:07:10.693Z",
  "startDate": "2023-02-13T11:07:10.693Z"
}

Response

Create coupon

messagestring
statusCodenumber
successboolean

Example response

{
  "data": {
    "_id": "64a3e5f7a22936b868265f3a",
    "couponCode": "GET600",
    "createdAt": "2023-07-04T09:27:19.381Z",
    "discountValue": 600,
    "expiryDate": "2024-06-13T11:07:10.693Z",
    "isActive": true,
    "minimumCartValue": 700,
    "name": "Season sale",
    "owner": "64a3daee2aaac053bc597276",
    "startDate": "2023-02-13T11:07:10.693Z",
    "type": "FLAT",
    "updatedAt": "2023-07-04T09:27:19.381Z"
  },
  "message": "Coupon created successfully",
  "statusCode": 201,
  "success": true
}