> For the complete documentation index, see [llms.txt](https://nextify.gitbook.io/api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nextify.gitbook.io/api/coupons-api.md).

# Coupon API

API cho phép quản lý Coupon/Voucher

## Thêm mới Coupon

<mark style="color:green;">`POST`</mark> `{{base_url}}/coupons`

Cho phép thêm mới coupon vào một địa điểm

#### Query Parameters

| Name    | Type   | Description |
| ------- | ------ | ----------- |
| pos\_id | string | id địa điểm |

#### Headers

| Name          | Type   | Description             |
| ------------- | ------ | ----------------------- |
| Authorization | string | Bearer \<access\_token> |
| Content-Type  | string | application/json        |

#### Request Body

| Name | Type   | Description                                      |
| ---- | ------ | ------------------------------------------------ |
| name | string | Mã CouponType                                    |
| code | string | Mã Coupon                                        |
| user | string | Số điện thoại của người dùng được áp dụng Coupon |

{% tabs %}
{% tab title="200 Thêm mới Coupon thành công" %}

```javascript
{
    "status": 200,
    "status_code": 200,
    "message": "Success!"
}
```

{% endtab %}

{% tab title="400 Sai dữ liệu truyền vào" %}

```
{
    "status": 400,
    "status_code": 400,
    "message": "Wrong data!"
}
```

{% endtab %}

{% tab title="401 access\_token không tồn tại" %}

```
{
    "status_code": 401,
    "message": "access_token not found! Please contact Nextify at support@nextify.vn for help"
}
```

{% endtab %}

{% tab title="404 pos\_id không tồn tại" %}

```javascript
{
    "status": 404,
    "status_code": 404,
    "message": "pos_id does not exist!"
}
```

{% endtab %}
{% endtabs %}
