API Tạo Link Token
Đặc tả endpoint khởi tạo phiên Hosted Link và các tham số cấu hình mục đích liên kết trong 4 ngôn ngữ.
Endpoint tạo phiên làm việc với các mục đích: Liên kết tài khoản (LINK_BANK_ACCOUNT) hoặc Hủy liên kết (UNLINK_BANK_ACCOUNT). Link Token có thời hạn sử dụng 30 phút.
Đặc tả Endpoint
| Mục | Giá trị |
|---|---|
| Method | POST |
| URL | https://bankhub-api.hitechcloud.vn/v1/link-token/create |
| Headers | Authorization: Bearer <TOKEN>, Content-Type: application/json |
Bảng tham số đầu vào (JSON Body)
| Tham số | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
company_xid | string | Có | Mã định danh công ty/đối tác trên HiTechCloud Pay |
purpose | string | Có | Mục đích phiên: LINK_BANK_ACCOUNT hoặc RELINK_BANK_ACCOUNT |
user_reference | string | Có | ID người dùng trên hệ thống của bạn (ví dụ: USER_99881) |
completion_redirect_uri | string | Có | URL chuyển hướng sau khi hoàn tất trên trình duyệt |
cURL tạo Link Token
curl -X POST "https://bankhub-api.hitechcloud.vn/v1/link-token/create" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"company_xid": "850e8400-e29b-41d4-a716-446655440000",
"purpose": "LINK_BANK_ACCOUNT",
"user_reference": "USR_99881",
"completion_redirect_uri": "https://example.com/bank/linked-success"
}'Tạo Link Token bằng PHP
<?php
$token = 'YOUR_ACCESS_TOKEN';
$data = [
'company_xid' => '850e8400-e29b-41d4-a716-446655440000',
'purpose' => 'LINK_BANK_ACCOUNT',
'user_reference' => 'USR_99881',
'completion_redirect_uri' => 'https://example.com/bank/linked-success'
];
$ch = curl_init('https://bankhub-api.hitechcloud.vn/v1/link-token/create');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer {$token}",
"Content-Type: application/json"
]);
$response = curl_exec($ch);
curl_close($ch);
$res = json_decode($response, true);
$hosted_url = $res['hosted_link_url']; // Mở URL này trong iframe hoặc redirect kháchPhản hồi tạo Link Token (200 OK)
{
"xid": "850e8400-e29b-41d4-a716-446655440000",
"hosted_link_url": "https://bankhub.hitechcloud.vn/link/850e8400-e29b-41d4-a716-446655440000",
"link_token": "950e8400-e29b-41d4-a716-446655440000",
"expires_at": "2026-10-31 10:30:00"
}Endpoint tạo phiên làm việc với các mục đích: Liên kết tài khoản (LINK_BANK_ACCOUNT) hoặc Hủy liên kết (UNLINK_BANK_ACCOUNT). Link Token có thời hạn sử dụng 30 phút.
Đặc tả Endpoint
| Mục | Giá trị |
|---|---|
| Method | POST |
| URL | https://bankhub-api.hitechcloud.vn/v1/link-token/create |
| Headers | Authorization: Bearer <TOKEN>, Content-Type: application/json |
Bảng tham số đầu vào (JSON Body)
| Tham số | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
company_xid | string | Có | Mã định danh công ty/đối tác trên HiTechCloud Pay |
purpose | string | Có | Mục đích phiên: LINK_BANK_ACCOUNT hoặc RELINK_BANK_ACCOUNT |
user_reference | string | Có | ID người dùng trên hệ thống của bạn (ví dụ: USER_99881) |
completion_redirect_uri | string | Có | URL chuyển hướng sau khi hoàn tất trên trình duyệt |
cURL tạo Link Token
curl -X POST "https://bankhub-api.hitechcloud.vn/v1/link-token/create" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"company_xid": "850e8400-e29b-41d4-a716-446655440000",
"purpose": "LINK_BANK_ACCOUNT",
"user_reference": "USR_99881",
"completion_redirect_uri": "https://example.com/bank/linked-success"
}'Tạo Link Token bằng PHP
<?php
$token = 'YOUR_ACCESS_TOKEN';
$data = [
'company_xid' => '850e8400-e29b-41d4-a716-446655440000',
'purpose' => 'LINK_BANK_ACCOUNT',
'user_reference' => 'USR_99881',
'completion_redirect_uri' => 'https://example.com/bank/linked-success'
];
$ch = curl_init('https://bankhub-api.hitechcloud.vn/v1/link-token/create');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer {$token}",
"Content-Type: application/json"
]);
$response = curl_exec($ch);
curl_close($ch);
$res = json_decode($response, true);
$hosted_url = $res['hosted_link_url']; // Mở URL này trong iframe hoặc redirect kháchPhản hồi tạo Link Token (200 OK)
{
"xid": "850e8400-e29b-41d4-a716-446655440000",
"hosted_link_url": "https://bankhub.hitechcloud.vn/link/850e8400-e29b-41d4-a716-446655440000",
"link_token": "950e8400-e29b-41d4-a716-446655440000",
"expires_at": "2026-10-31 10:30:00"
}