# Deprecated APIs

## APIs

## Check quantity

<mark style="color:green;">`POST`</mark> `{API-HOST}/merchant-integration/v1/loyalty/gift-code/quantity`

API để kiểm tra số lượng giftcode còn lại trong kho của merchant.

#### Request Body

| Name        | Type   | Description                                                                                                         |
| ----------- | ------ | ------------------------------------------------------------------------------------------------------------------- |
| store\_code | string | Mã cửa hàng của merchant tại VinID.                                                                                 |
| pos\_code   | string | Mã máy POS của merchant tại VinID.                                                                                  |
| card\_type  | array  | <p>Danh sách mệnh giá giftcode cần kiểm tra.<br>Đơn vị: nghìn đồng.<br>Ví dụ: <code>\[“10”, "50", "100"]</code></p> |

{% tabs %}
{% tab title="200 " %}

```
{
  "meta": {
    "code": 200,
    "message": "OK"
  },
  "data": [
    {
      "card_type": "string",
      "quantity": 0
    }
  ]
}
```

{% endtab %}
{% endtabs %}

## Withdraw Giftcode

<mark style="color:green;">`POST`</mark> `{API-HOST}/merchant-integration/v1/loyalty/gift-code/orders`

API để lấy giftcode ra khỏi kho<br>

#### Request Body

| Name                | Type    | Description                                                                                                                                          |
| ------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| store\_code         | string  | Mã cửa hàng của merchant tại VinID                                                                                                                   |
| pos\_code           | string  | Mã máy pos của merchant tại VinID                                                                                                                    |
| merchant\_order\_id | string  | Mã order unique phía merchant tự sinh                                                                                                                |
| order\_info         | array   | Thông tin của lệnh lấy giftcode.                                                                                                                     |
| card\_type          | string  | <p>Mệnh giá giftcode cần lấy.<br>Đơn vị: <strong>nghìn đồng</strong>.</p>                                                                            |
| quantity            | integer | Số lượng giftcode cần lấy                                                                                                                            |
| extra\_data         | string  | <p>Thông tin bổ sung của order.<br>Merchant có thể truyền thêm các dữ liệu cần thiết cho nghiệp vụ của mình theo string dạng JSON trong phần này</p> |

{% tabs %}
{% tab title="200 " %}

```
{
  "meta": {
    "code": int,
    "message": "string"
  },
  "data": {
    "created_at": 0,
    "extra_data: "string"
    "merchant_order_id": "string",
    "order_info": [
      {
        "card_type": "string", //Mệnh giá giftcode
        "cards": [
          {
            "code": "string", //Mã nạp của giftcode
            "expire_date": "string", //Ngày hết hạn
            "serial": "string" //Mã tra soát
          }
        ]
      }
    ]
  }

```

{% endtab %}
{% endtabs %}

{% code title="REQUEST TEMPLATE" %}

```
{
  "store_code": "string",
  "pos_code": "string",
  "merchant_order_id": "string",
  "order_info": [
    {
      "card_type": "string",
      "quantity": 10
    }
  ],
  "extra_data": "string"
}
```

{% endcode %}

## Check giftcode

<mark style="color:green;">`POST`</mark> `{API-HOST}/merchant-integration/v1/loyalty/gift-code/check`

API để kiểm tra trạng thái của giftcode

#### Request Body

| Name        | Type   | Description                         |
| ----------- | ------ | ----------------------------------- |
| store\_code | string | Mã cửa hàng của merchant tại VinID  |
| pos\_code   | string | Mã máy pos của merchant tại VinID   |
| serial      | string | Mã serial của giftcode cần kiểm tra |

{% tabs %}
{% tab title="200 " %}
{% tabs %}
{% tab title="Serial chính xác" %}

```
{
  "meta": {
    "code": int,
    "message": "string"
  },
  "data": {
    "status": "USED", //“USED” hoặc “ACTIVE”
    "expire_date": "yyyy-MM-dd" //Hạn sử dụng
  }
}
```

{% endtab %}

{% tab title="Serial không hợp lệ" %}

```
{
  "meta": {
    "code": int,
    "message": "string"
  },
  "data": }
```

{% endtab %}
{% endtabs %}
{% endtab %}
{% endtabs %}

## Get order detail

<mark style="color:blue;">`GET`</mark> `{API-HOST}/merchant-integration/v1/loyalty/gift-code/orders?{parameters}`

API để yêu cầu lấy thông tin của đơn hàng đã thực hiện

#### Path Parameters

| Name                | Type   | Description                                                                       |
| ------------------- | ------ | --------------------------------------------------------------------------------- |
| store\_code         | string | Mã cửa hàng của merchant tại VinID                                                |
| pos\_code           | string | Mã máy pos của merchant tại VinID                                                 |
| merchant\_order\_id | string | <p>Mã order muốn kiểm tra.<br>(Là mã order merchant đã sử dụng khi tạo order)</p> |

{% tabs %}
{% tab title="200 " %}

```
{
  "meta": {
    "code": int,
    "message": "string"
  },
  "data": {
    "created_at": 0,
    "extra_data": "string",
    "merchant_order_id": "string",
    "order_info": [
      {
        "card_type": "string",
        "cards": [
          {
            "code": "string", //Mã nạp của giftcode
            "expire_date": "string", //Ngày hết hạn
            "serial": "string" //Mã tra soát
          }
        ]
      }
    ]   
  }
```

{% endtab %}
{% endtabs %}

{% code title="REQUEST TEMPLATE" %}

```
{API-HOST}/merchant-integration/v1/loyalty/giftcode/orders?merchant_order_id=string&store_code=string&pos_code=string
```

{% endcode %}

## Mã lỗi

| Code    | Message                               |
| ------- | ------------------------------------- |
| 4000001 | Dữ liệu không hợp lệ                  |
| 4000301 | Số lượng giftcode trong kho không đủ  |
| 4000302 | Mã order đã tồn tại                   |
| 5000001 | Hệ thống xảy ra lỗi khi xử lý yêu cầu |

Tham khảo bảng [Mã lỗi chung](/tai-lieu-tich-hop/bang-ma-loi.md)

Xem thêm:

* [API Host](/tai-lieu-tich-hop/moi-truong-tich-hop.md)
* [Quy tắc kết nối](/tai-lieu-tich-hop/quy-tac-ket-noi.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.vinid.net/tai-lieu-tich-hop/tich-hop-voi-vinid-loyalty/dich-vu-vinid-giftcode/deprecated-apis.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
