Chuyển tới nội dung chính

Điểm thưởng

Base URL

{baseUrl}/api/v6.1

1. Get Account Bonus Points

Endpoint

GET /account

Description

Lấy thông tin điểm thưởng (bonus points) hiện tại của một khách hàng (KH) dựa theo mã khách hàng account_code.

Request

curl --location '{baseUrl}/api/v6.1/account?account_code=KH%2F2025%2F011987&fields=id%2Caccount_code%2Ctotal_point_bonus' \
--header 'X-API-KEY: {api_key}'

Query Parameters

NameTypeRequiredDescription
account_codestringYesMã khách hàng cần truy vấn
fieldsstringYesCác trường cần lấy, phân cách dấu phẩy (,)

Response

{
"id": 12037,
"account_code": "KH/2025/011987",
"total_point_bonus": 301,
"custom_fields": []
}

Notes

  • Trường total_point_bonus là số điểm thưởng hiện tại.

2. Add Bonus Points to Account

Endpoint

POST /account/points/bonus

Description

Thêm điểm thưởng (bonus points) cho một khách hàng cụ thể.

Request

curl --location '{baseUrl}/api/v6.1/account/points/bonus' \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: {api_key}' \
--data '{
"account_code": "KH/2025/011987",
"point": 301,
"reason": "Cho khách hàng thêm 301 điểm thưởng"
}'

Request Body

FieldTypeRequiredDescription
account_codestringYesMã khách hàng
pointintYesSố điểm thưởng cần cộng
reasonstringYesGhi chú lý do cộng điểm

Response

{
"message": "Cập nhật thành công",
"account_code": "KH/2025/011987",
"account_id": 12037,
"account_points": 602
}

Notes

  • Trường account_points phản ánh tổng điểm sau khi cập nhật.
  • Đảm bảo account_code hợp lệ để tránh lỗi.

Authentication

  • Yêu cầu X-API-KEY hợp lệ.

Example Use Case

  1. Lấy điểm của KH KH/2025/011987 → thấy có 301 điểm.
  2. Cộng thêm 301 điểm với lý do "Cho khách hàng thêm 301 điểm thưởng" → tổng điểm mới: 602.