API Lấy cấu hình Webhook
API lấy cấu hình webhook hiện tại của merchant. Webhook được dùng để nhận thông báo sự kiện từ Bank Hub.
API Endpoint
GET
https://bankhub-api-sandbox.sepay.vn/v1/webhookLưu ý
- API này yêu cầu Bearer Token trong header Authorization
- Trả về cấu hình webhook hiện tại của merchant
- Nếu chưa cấu hình webhook, trả về
data: null - Secret key được che (hiển thị 4 ký tự cuối)
Xử lý lỗi
401UnauthorizedAccess token không hợp lệ hoặc đã hết hạn
API Response
Response 200 - Thành công
{
"status": 200,
"error": "string",
"messages": {
"success": [
"string"
],
"error": [
"string"
]
},
"data": {
"webhook_url": "https://example.com",
"auth_type": "SECRET_KEY",
"secret_key": "***5678",
"request_content_type": "application/json",
"active": 0,
"allow_events": [
"*"
]
}
}statusinteger
Mã trạng thái HTTP
errorstring
Mã lỗi (nếu có)
messagesobject
Thông báo kết quả
dataobject
Cấu hình webhook (secret key được che)
Code mẫu
1
2
3
curl --request GET \--url https://bankhub-api-sandbox.sepay.vn/v1/webhook \--header 'Authorization: Bearer REPLACE_BEARER_TOKEN'
Ví dụ sử dụng
JSLấy cấu hình webhook
1
2
curl --location 'https://bankhub-api-sandbox.sepay.vn/v1/webhook' \--header 'Authorization: Bearer YOUR_ACCESS_TOKEN'
Allow Events Configuration
Cách hoạt động:
nullhoặc[]: Không gửi bất kỳ sự kiện nào["*"]: Gửi tất cả 13 loại sự kiện["BANK_ACCOUNT_LINKED", "BANK_ACCOUNT_UNLINKED"]: Chỉ gửi các sự kiện cụ thể
13 loại sự kiện:
- Link Token:
LINK_TOKEN_CREATED,LINK_TOKEN_REVOKED,LINK_TOKEN_EXPIRED - Link Session:
LINK_SESSION_INITIALIZED,LINK_SESSION_REINITIALIZED,LINK_SESSION_STATE_CHANGED,LINK_SESSION_COMPLETED,LINK_SESSION_FAILED,LINK_SESSION_ABANDONED,LINK_SESSION_EXPIRED - Bank Account:
BANK_ACCOUNT_LINKED,BANK_ACCOUNT_UNLINKED,BANK_ACCOUNT_INACTIVATED
Secret Key Display
- Trong GET response, secret key được che để bảo mật
- Chỉ hiển thị 4 ký tự cuối:
***5678 - Secret key đầy đủ chỉ trả về khi tạo/cập nhật qua POST
Lưu ý quan trọng
- Nếu
datalànull, merchant chưa cấu hình webhook - Secret key được mask trong GET response (hiển thị
***xxxx) allow_events = nullhoặc[]nghĩa là webhook sẽ không gửi bất kỳ event nào- Active = 0 nghĩa là webhook bị tắt, không gửi event dù có cấu hình
allow_events