> For the complete documentation index, see [llms.txt](https://developers.vinid.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.vinid.net/tai-lieu-tich-hop/tich-hop-voi-vinid-loyalty/dich-vu-lay-hang-thanh-vien-trung-thanh.md).

# Dịch vụ lấy hạng thành viên trung thành

### Giới thiệu dịch vụ  <a href="#gioi-thieu-dich-vu" id="gioi-thieu-dich-vu"></a>

Là giải pháp giúp các bên đối tác lấy hạng của thành viên trung thành (vàng, bạc đồng) của VinID.

Khách hàng mua hàng, sử dụng dịch vụ của đối tác VinID khi đối tác không có hệ thống loyalty, khi thực hiện thanh toán bằng VinID, hệ thống sẽ lấy hạng thành viên của khách hàng. Theo đó, khách hàng sẽ được giảm giá dựa theo thứ hạng thành viên của mình trong VinID.

### Luồng người dùng sử dụng dịch vụ <a href="#luong-nguoi-dung-su-dung-dich-vu" id="luong-nguoi-dung-su-dung-dich-vu"></a>

![](/files/-Mg3yXnNtlvBVZBCqXCP)

### Sơ đồ xử lý kĩ thuật <a href="#so-do-xu-ly-ki-thuat" id="so-do-xu-ly-ki-thuat"></a>

>

![](/files/-Mg3yqNzmY_jaSYKtttu)

### APIs <a href="#apis" id="apis"></a>

{% hint style="info" %}
Lưu ý:

Merchant muốn lấy thông tin hạng thành viên VinID cần được cấp quyền cụ thể `allow_loyalty_membership_check`. Khi onboard một merchant hoặc một merchant đăng kí sử dụng dịch vụ này cần được set thêm quyền này trong database.
{% endhint %}

## Lấy thông tin hạng thành viên&#x20;

<mark style="color:blue;">`GET`</mark> `{API_HOST}/merchant-integration/v1/loyalty/membership?id_type=string&identity=string&business_code=string&program_code=string`

#### Path Parameters

| Name           | Type   | Description                                                                                                                                |
| -------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------ |
| id\_type       | string | <p>USER\_ID: Vinid User<br>MOBILE: User's phonenumber<br>CARD: Loyalty Card Number<br>MEMBER\_ID: Member code, Customer Loyalty Number</p> |
| identity       | string | user\_id, phone number, card number, member code according to id\_type                                                                     |
| business\_code | string | the owner of the loyalty program, eg: VGC                                                                                                  |
| program\_code  | string | the loyalty program, eg: VGC                                                                                                               |

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

```
{
  "data": {
    "member": {
      "member_code": "string",
      "full_name": "string"
    },
    "tier_info": {
      "tier_code": "string",
      "tier_name": "string",
      "description": "string"
    } 
  },
  "meta": {
    "code": int,
    "message": "string"
  }
}

```

{% endtab %}
{% endtabs %}

### Những mã lỗi có thể xảy ra <a href="#nhung-ma-loi-co-the-xay-ra" id="nhung-ma-loi-co-the-xay-ra"></a>

* 401005: identity\_type not supported
* 400002: invalid phone\_number format
* 401006: invalid customer id
* 401007: invalid loyalty business
* 401008: invalid loyalty program
* 500503: generic OLS error
