MSB API
Tích hợp giao dịch MSB
API MSB cung cấp danh sách giao dịch dạng JSON cho luồng thanh toán và đối soát tự động. Kết nối này phù hợp cho website dịch vụ, bán hàng đa kênh và hệ thống quản trị dòng tiền.
Phương thứcGET
Định dạngJSON
Xác thựcToken
Phiên bảnV1, V2, V3
Tài liệu API theo phiên bản
Chọn phiên bản tương ứng trong trang quản lý tài khoản MSB để xem tham số và dữ liệu trả về.
Tham số cần thiết
| Tham số | Bắt buộc | Mô tả |
|---|---|---|
YOUR_TOKEN | Có | Token API được cấp trong trang quản lý. |
Code mẫu
curl --request GET \
"https://thueapibank.vn/historyapimsb/YOUR_TOKEN" \
--header "Accept: application/json"
<?php
$ch = curl_init('https://thueapibank.vn/historyapimsb/YOUR_TOKEN');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 20,
CURLOPT_HTTPHEADER => ['Accept: application/json'],
]);
$response = curl_exec($ch);
$data = json_decode($response, true, flags: JSON_THROW_ON_ERROR);
curl_close($ch);
const response = await fetch('https://thueapibank.vn/historyapimsb/YOUR_TOKEN', {
headers: { Accept: 'application/json' }
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const data = await response.json();
Response mẫu
{
"status": "200",
"message": "",
"inforError": "",
"tokenNo": null,
"timeCreateToken": null,
"data": {
"endDate": "2024-06-22",
"isStaging": false,
"toDate": "2024-07-09",
"fromAmount": null,
"accNo": "14001010096743",
"toAmount": null,
"CNT": "Kênh khác",
"history": [
{
"coreSn": "20240709094900760174",
"tranSn": null,
"tranServiceCode": "N",
"traceCode": "NP1321I",
"dcSign": "C",
"acceptsOrg": null,
"tranType": "CK nội bộ",
"tranDevice": null,
"deviceNo": "258",
"voucherType": null,
"currencyCode": "VND",
"rolloutAcctNo": "14001010096743",
"rolloutAcctName": null,
"rolloutCardNo": null,
"beneficiaryAcctNo": null,
"beneficiaryAcctName": null,
"beneficiaryAcctBank": null,
"beneficiaryAcctBranch": null,
"beneficiaryCardNo": null,
"amount": 5000,
"fee": null,
"preBalance": 10000,
"actBalance": null,
"postTime": 1720493340000,
"tranTime": null,
"status": null,
"operator": null,
"channel": "CNT",
"remark": "-887403-nap1_0373102354",
"insertDate": null,
"tellerId": "VASML247",
"tmSeq": "FT24191R9W3B",
"syncType": 0,
"tcCode": null,
"tcSyncTime": null,
"isDetail": false,
"transferDate": "09/07/2024",
"transferTime": "09:49",
"channelName": "Kênh khác",
"indentifyNumber": null,
"lnTime": null,
"dueDate": null,
"osBalance": null
},
{
"coreSn": "20240622202900680865",
"tranSn": null,
"tranServiceCode": "N",
"traceCode": "NP1321I",
"dcSign": "C",
"acceptsOrg": null,
"tranType": "CK nội bộ",
"tranDevice": null,
"deviceNo": "258",
"voucherType": null,
"currencyCode": "VND",
"rolloutAcctNo": "14001010096743",
"rolloutAcctName": null,
"rolloutCardNo": null,
"beneficiaryAcctNo": null,
"beneficiaryAcctName": null,
"beneficiaryAcctBank": null,
"beneficiaryAcctBranch": null,
"beneficiaryCardNo": null,
"amount": 5000,
"fee": null,
"preBalance": 5000,
"actBalance": null,
"postTime": 1719062940000,
"tranTime": null,
"status": null,
"operator": null,
"channel": "CNT",
"remark": "-104319-Nguyen Nhat Loc chuyen tien_0373102354",
"insertDate": null,
"tellerId": "VASML247",
"tmSeq": "FT24174GMNM5",
"syncType": 0,
"tcCode": null,
"tcSyncTime": null,
"isDetail": false,
"transferDate": "22/06/2024",
"transferTime": "20:29",
"channelName": "Kênh khác",
"indentifyNumber": null,
"lnTime": null,
"dueDate": null,
"osBalance": null
}
],
"MBA": "Mobile Banking",
"userId": null,
"currentChannel": "IB",
"content": null,
"queryType": 0,
"fromDate": "2024-04-01",
"eltDate": 5000,
"startTime": 1720458000000,
"page": 1,
"IBS": "Internet Banking",
"endTime": 1720544399999,
"accType": "CA"
},
"peekData": null
}
Tham số cần thiết
| Tham số | Bắt buộc | Mô tả |
|---|---|---|
YOUR_TOKEN | Có | Token API được cấp trong trang quản lý. |
Code mẫu
curl --request GET \
"https://thueapibank.vn/historyapimsbv2/YOUR_TOKEN" \
--header "Accept: application/json"
<?php
$ch = curl_init('https://thueapibank.vn/historyapimsbv2/YOUR_TOKEN');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 20,
CURLOPT_HTTPHEADER => ['Accept: application/json'],
]);
$response = curl_exec($ch);
$data = json_decode($response, true, flags: JSON_THROW_ON_ERROR);
curl_close($ch);
const response = await fetch('https://thueapibank.vn/historyapimsbv2/YOUR_TOKEN', {
headers: { Accept: 'application/json' }
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const data = await response.json();
Response mẫu
{
"status": "success",
"message": "Thành công",
"transactions": [
{
"transactionID": 3172,
"amount": 13000,
"description": "E4S9J GD 519816-013124 22:29:46",
"transactionDate": "01/02/2024",
"type": "IN"
},
{
"transactionID": 3171,
"amount": 10000,
"description": "Thanh toan QR E923Z GD 343127-013124 20:40:43",
"transactionDate": "01/02/2024",
"type": "OUT"
}
]
}
Tham số cần thiết
| Tham số | Bắt buộc | Mô tả |
|---|---|---|
PASSWORD | Có | Mật khẩu hoặc mã xác thực kết nối. |
ACCOUNT_NUMBER | Có | Số tài khoản MSB cần truy vấn. |
YOUR_TOKEN | Có | Token API được cấp trong trang quản lý. |
Code mẫu
curl --request GET \
"https://thueapibank.vn/historyapimsbv3/PASSWORD/ACCOUNT_NUMBER/YOUR_TOKEN" \
--header "Accept: application/json"
<?php
$ch = curl_init('https://thueapibank.vn/historyapimsbv3/PASSWORD/ACCOUNT_NUMBER/YOUR_TOKEN');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 20,
CURLOPT_HTTPHEADER => ['Accept: application/json'],
]);
$response = curl_exec($ch);
$data = json_decode($response, true, flags: JSON_THROW_ON_ERROR);
curl_close($ch);
const response = await fetch('https://thueapibank.vn/historyapimsbv3/PASSWORD/ACCOUNT_NUMBER/YOUR_TOKEN', {
headers: { Accept: 'application/json' }
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const data = await response.json();
Response mẫu
{
"status": "success",
"message": "Thành công",
"transactions": [
{
"type": "IN",
"transactionID": "FT26091912345678",
"amount": 450000,
"description": "DH1024 THANH TOAN",
"transactionDate": "2026-09-19 10:24:36"
}
]
}
Response thực tế có thể bổ sung trường riêng của MSB. Luôn kiểm tra trường tồn tại trước khi đọc.
Luồng xử lý khuyến nghị
- 1Lưu mã giao dịch
Dùng
transactionIDlàm khóa chống xử lý trùng. - 2Chỉ xử lý tiền vào
Kiểm tra
type === "IN"trước khi ghép đơn. - 3Ghép đúng đơn hàng
So khớp số tiền và mã đơn trong nội dung chuyển khoản.
- 4Đối soát lại
Chạy tác vụ định kỳ để bù các webhook bị chậm hoặc thất bại.
Câu hỏi về API MSB
API MSB dùng để làm gì?
API giúp lấy dữ liệu giao dịch MSB dạng JSON để xác nhận chuyển khoản, cộng số dư và đối soát tự động.
Nên dùng phiên bản API nào?
Nên ưu tiên phiên bản mới nhất mà tài khoản của bạn đang hỗ trợ. V1 và V2 phù hợp tích hợp bằng token; V3 bổ sung thông tin tài khoản trong đường dẫn.
Có thể nhận giao dịch MSB qua webhook không?
Có. Sau khi thêm tài khoản, bạn có thể cấu hình URL webhook để hệ thống gửi sự kiện giao dịch mới về máy chủ của bạn.