> ## Documentation Index
> Fetch the complete documentation index at: https://docs.clearline.me/llms.txt
> Use this file to discover all available pages before exploring further.

# Coupons sync from CMC to POS

# Get Coupons data

To obtain coupons that the Seller can use during a transaction (apply to a purchase), it is possible to use the following endpoints:

1. Get Customer Coupons (SearchUserCoupons) - Returns array of Customer coupons by search params (returns all coupons of the specified Customer).
2. Get Active Coupons By Location - Returns array of all active coupons of the specified pos location.

## Get Customer Coupons

**POST**  [https://apitest.clearline.me/pos/\{posSystemId}/coupon/couponCode/search](https://apitest.clearline.me/pos/\{posSystemId}/coupon/couponCode/search)

### Input request

```json theme={null}
{
  "code": "string",
  "email": "string",
  "phone": "string",
  "posLocationId": "string"
}
```

### Input parameters

| Field name    | Description                                           |
| ------------- | ----------------------------------------------------- |
| code          | Coupon code                                           |
| email         | Customer email                                        |
| phone         | Customer phone                                        |
| posLocationId | ID of the location where the transaction will be made |

### Response

```json theme={null}
{
  "data": [
    {
      "rewardProvider": "TwoReward",
      "code": "string",
      "name": "string",
      "title": "string",
      "pictureUrl": "string",
      "availableUntil": "2025-07-23T15:30:55.308Z",
      "status": "Issued",
      "info": [
        {
          "title": "string",
          "items": {
            "additionalProp1": "string",
            "additionalProp2": "string",
            "additionalProp3": "string"
          }
        }
      ]
    }
  ],
  "page": {
    "page": 0,
    "pageSize": 0,
    "total": 0
  },
  "posStatus": "Accepted"
}
```

## Get Active Coupons By Location

**GET** [https://apitest.clearline.me/pos/\{posSystemId}/coupon/active/locationId/\{posLocation}](https://apitest.clearline.me/pos/\{posSystemId}/coupon/active/locationId/\{posLocation})

### Input request

```json theme={null}
{
  "posSystemId": "string",
  "posLocationId": "string"
}
```

### Input parameters

| Field name    | Description                                           |
| ------------- | ----------------------------------------------------- |
| posSystemId   | POS System ID                                         |
| posLocationId | ID of the location where the transaction will be made |

### Response

```json theme={null}
{
  "data": [
    {
      "id": "string",
      "code": "string",
      "url": "string",
      "couponImage": "string",
      "status": "example | active | archived | template | deleted",
      "name": "string",
      "title": "string",
      "subtitle": "string",
      "description": "string",
      "couponCategoryId": "string",
      "couponCategoryName": "string",
      "banner1": "string",
      "banner2": "string",
      "banner3": "string",
      "banner4": "string",
      "banner5": "string",
      "subaccount": "string",
      "logoUrl": "string",
      "couponTags": "string",
      "expiryDate": "string",
      "promotion": {
        "value": 0,
        "promotionType": 1
      },
      "isSelected": true
    }
  ],
  "page": {
    "page": 0,
    "pageSize": 0,
    "total": 0
  },
  "posStatus": "Accepted"
}
```

### Apply discount to order

In order to apply a discount to an order, we need to use these parameters:

```json theme={null}
"promotion": {
"value": 50.0,
"promotionType": "Percentage"
}
```

### Response Example

```json theme={null}
{
  "posStatus": "Accepted",
  "page": {
    "page": 1,
    "pageSize": 5,
    "total": 5
  },
  "data": [
    {
      "id": "cam_1192028",
      "code": "Cstpt",
      "url": "https://coupon.2reward.me/p/Cstpt",
      "couponImage": "https://www.hosting4images.com/upload/customimage/9177_logo_240725022923.jpg",
      "status": "active",
      "name": "Restaurant 50% OFF",
      "title": "Main Board Set",
      "subtitle": "50% off",
      "description": "<p style=\"text-align:center\">¡Solo 1 cupón por cliente por día!<br>¡No es válido los fines de semana!<br>Cupón de ejemplo</p>",
      "couponCategoryId": "0",
      "couponCategoryName": "Other",
      "banner1": "https://www.hosting4images.com/preview/Cstpt_120-600.jpg",
      "banner2": "https://www.hosting4images.com/preview/Cstpt_140-112_20240725163012.jpg",
      "banner3": "https://www.hosting4images.com/preview/Cstpt_180-270_20240725163012.jpg",
      "banner4": "https://www.hosting4images.com/preview/Cstpt_200-150.jpg",
      "banner5": "https://www.hosting4images.com/preview/Cstpt_200-600.jpg",
      "subaccount": "sub_9871",
      "logoUrl": "https://www.hosting4images.com/upload/logo/9177_logo_240725022923.jpg",
      "couponTags": "",
      "expiryDate": "2month",
      "promotion": {
        "value": 50.0,
        "promotionType": "Percentage"
      },
      "isSelected": null
    },
    {
      "id": "cam_1192027",
      "code": "UWzTt",
      "url": "https://coupon.2reward.me/p/UWzTt",
      "couponImage": "https://www.hosting4images.com/upload/customimage/9177_logo_240725022923.jpg",
      "status": "active",
      "name": "Restaurant Special Menu 50% Off",
      "title": "SPECIAL MENU",
      "subtitle": "UP TO 50% OFF",
      "description": "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>",
      "couponCategoryId": "0",
      "couponCategoryName": "Other",
      "banner1": "https://www.hosting4images.com/preview/UWzTt_120-600.jpg",
      "banner2": "https://www.hosting4images.com/preview/UWzTt_140-112_20240725163330.jpg",
      "banner3": "https://www.hosting4images.com/preview/UWzTt_180-270_20240725163330.jpg",
      "banner4": "https://www.hosting4images.com/preview/UWzTt_200-150.jpg",
      "banner5": "https://www.hosting4images.com/preview/UWzTt_200-600.jpg",
      "subaccount": "sub_9871",
      "logoUrl": "https://www.hosting4images.com/upload/logo/9177_logo_240725022922.jpg",
      "couponTags": "",
      "expiryDate": "2month",
      "promotion": {
        "value": 50.0,
        "promotionType": "Percentage"
      },
      "isSelected": null
    }
  ]
}
```
