API Cập nhật cấu hình Merchant

API cập nhật cấu hình merchant bao gồm transaction whitelist keywords và custom CSS cho hosted link.


API Endpoint

POST
https://bankhub-api-sandbox.sepay.vn/v1/merchant-config

Request Body

transaction_whitelist_remark_keywordsarray<string>

Từ khóa whitelist cho nội dung giao dịch

global_hosted_link_custom_cssstring

Custom CSS cho hosted link

Lưu ý
  • API này yêu cầu Bearer Token trong header Authorization
  • Hỗ trợ partial update: chỉ gửi các trường cần cập nhật
  • Các trường không gửi sẽ giữ nguyên giá trị cũ
  • Cấu hình áp dụng ngay lập tức cho tất cả hosted link

Xử lý lỗi

400Validation Error

Dữ liệu đầu vào không hợp lệ (CSS chứa script, keywords không phải array, v.v.)

401Unauthorized

Access token không hợp lệ hoặc đã hết hạn

API Response

Response 200 - Cập nhật thành công
{
  "data": {
    "transaction_whitelist_remark_keywords": [
      "string"
    ],
    "global_hosted_link_custom_css": "string",
    "logo_url": "https://example.com"
  }
}
dataobject

Cấu hình merchant

Code mẫu

1
2
3
4
5
curl --request POST \
--url https://bankhub-api-sandbox.sepay.vn/v1/merchant-config \
--header 'Authorization: Bearer REPLACE_BEARER_TOKEN' \
--header 'content-type: application/json' \
--data '{"transaction_whitelist_remark_keywords":["string"],"global_hosted_link_custom_css":"string"}'

Ví dụ sử dụng

JSCập nhật whitelist keywords
1
2
3
4
5
6
curl --location 'https://bankhub-api-sandbox.sepay.vn/v1/merchant-config' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
--data '{
"transaction_whitelist_remark_keywords": ["thanh toan", "payment", "chuyen khoan"]
}'
JSCập nhật custom CSS
1
2
3
4
5
6
curl --location 'https://bankhub-api-sandbox.sepay.vn/v1/merchant-config' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
--data '{
"global_hosted_link_custom_css": "body { background: #f0f0f0; color: #333; }"
}'
JSCập nhật cả hai cùng lúc
1
2
3
4
5
6
7
curl --location 'https://bankhub-api-sandbox.sepay.vn/v1/merchant-config' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
--data '{
"transaction_whitelist_remark_keywords": ["thanh toan"],
"global_hosted_link_custom_css": "body { background: #ffffff; }"
}'

Validation Rules

Transaction Whitelist Keywords:

  • Từ khóa được trim và loại bỏ trùng lặp
  • Từ khóa rỗng bị từ chối

Global Hosted Link Custom CSS:

  • Yêu cầu quyền admin cho global_hosted_link_custom_css
  • CSS được làm sạch để ngăn tấn công XSS