CTG API
Tích hợp giao dịch VietinBank
Khai thác lịch sử giao dịch VietinBank qua một endpoint đơn giản để tự động hóa thu tiền và đối soát. Kết nối này phù hợp cho ERP nội bộ, website dịch vụ, trung tâm đào tạo và hệ thống thu hộ.
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 VietinBank để 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/historyapiviettin/YOUR_TOKEN" \
--header "Accept: application/json"
<?php
$ch = curl_init('https://thueapibank.vn/historyapiviettin/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/historyapiviettin/YOUR_TOKEN', {
headers: { Accept: 'application/json' }
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const data = await response.json();
Response mẫu
{
"requestId": "DSDSDSSD|1712330145821",
"sessionId": "DSDSDS",
"error": false,
"accountNo": "6564654654654",
"currentPage": 0,
"nextPage": 1,
"pageSize": 100,
"totalRecords": 188,
"warningMsg": "",
"transactions": [
{
"currency": "VND",
"remark": "CT DI:408612191663 Chuyen tien",
"amount": "1010000.00",
"balance": "0.00",
"trxId": "144S24317GBWKNMM",
"processDate": "26-03-2024 12:11:54",
"dorC": "D",
"refType": "HistoryRecordSequence",
"refId": "90",
"tellerId": "mobile",
"corresponsiveAccount": "8800305995",
"corresponsiveName": "NGUYEN VAN B",
"channel": "78 - Retail Internet Banking",
"serviceBranchId": "14498",
"serviceBranchName": "CN DONG ANH - HOI SO",
"pmtType": "RTGS - Chuyển tiền nhanh",
"sendingBankId": "",
"sendingBranchId": "",
"sendingBranchName": "",
"receivingBankId": "970418",
"receivingBranchId": "",
"receivingBranchName": "BIDV_NHTMCP DT va PT VN"
},
{
"currency": "VND",
"remark": "CT DEN:408604798949 nrogo1296995",
"amount": "20000.00",
"balance": "1010000.00",
"trxId": "144S24317F0YRCXH",
"processDate": "26-03-2024 11:37:53",
"dorC": "C",
"refType": "HistoryRecordSequence",
"refId": "89",
"tellerId": "1000819",
"corresponsiveAccount": "3144181904",
"corresponsiveName": "NGUYEN VAN A",
"channel": "28 - Transware (TWO) Switch via Banknet VPG (VTB Payment Gateway)",
"serviceBranchId": "14498",
"serviceBranchName": "CN DONG ANH - HOI SO",
"pmtType": "RTGSIN - Chuyển tiền nhanh",
"sendingBankId": "970488",
"sendingBranchId": "",
"sendingBranchName": "BIDV_NHTMCP DT va PT VN",
"receivingBankId": "",
"receivingBranchId": "",
"receivingBranchName": ""
}
]
}
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/historyapiviettinv2/YOUR_TOKEN" \
--header "Accept: application/json"
<?php
$ch = curl_init('https://thueapibank.vn/historyapiviettinv2/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/historyapiviettinv2/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 VietinBank 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/historyapiviettinv3/PASSWORD/ACCOUNT_NUMBER/YOUR_TOKEN" \
--header "Accept: application/json"
<?php
$ch = curl_init('https://thueapibank.vn/historyapiviettinv3/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/historyapiviettinv3/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 VietinBank. 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 VietinBank
API VietinBank dùng để làm gì?
API giúp lấy dữ liệu giao dịch VietinBank 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 VietinBank 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.