Test mode
Chỉ dùng với khóa hk_test_. Mô phỏng tiền về để thử toàn bộ luồng mà không cần chuyển tiền thật.
Mô phỏng tiền về
POST/v1/test/bank_transfers
Chỉ test modeCần Idempotency-Key
Tạo một giao dịch tiền về giả và phát sự kiện thật như production. Ghi referenceCode của một yêu cầu thanh toán vào description để thử luồng tự khớp.
Nội dung gửi lên
amountintegerbắt buộcSố tiền giả lập, số nguyên VND, tối thiểu 1.000.
descriptionstringbắt buộcNội dung chuyển khoản như khách gõ. Ghi
referenceCodeđể thử tự khớp.counterpartyNamestringTên người chuyển (tùy chọn).
Trả về
201 · BankTransaction
Lỗi có thể gặp
test_mode_only403 Chỉ dùng được với khóahk_test_.validation_error400 Dữ liệu gửi lên không hợp lệ – xemmessage.
curl -X POST https://api.hensa.example/v1/test/bank_transfers \ -H "Authorization: Bearer $HENSA_TEST_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"amount":150000,"description":"LK7F3K9 thanh toan don hang","counterpartyName":"NGUYEN VAN AN"}'const res = await fetch('https://api.hensa.example/v1/test/bank_transfers', { method: 'POST', headers: { Authorization: `Bearer ${process.env.HENSA_TEST_KEY}`, 'Idempotency-Key': crypto.randomUUID(), 'Content-Type': 'application/json' }, body: JSON.stringify({ "amount": 150000, "description": "LK7F3K9 thanh toan don hang", "counterpartyName": "NGUYEN VAN AN" })})const data = await res.json()<?php$ch = curl_init('https://api.hensa.example/v1/test/bank_transfers');curl_setopt_array($ch, [ CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ 'Authorization: Bearer ' . getenv('HENSA_TEST_KEY'), 'Idempotency-Key: ' . bin2hex(random_bytes(16)), 'Content-Type: application/json', ], CURLOPT_POSTFIELDS => '{"amount":150000,"description":"LK7F3K9 thanh toan don hang","counterpartyName":"NGUYEN VAN AN"}',]);$data = json_decode(curl_exec($ch), true);import os, uuid, requests
res = requests.post( "https://api.hensa.example/v1/test/bank_transfers", headers={ "Authorization": f"Bearer {os.environ['HENSA_TEST_KEY']}", "Idempotency-Key": str(uuid.uuid4()), }, json={ "amount": 150000, "description": "LK7F3K9 thanh toan don hang", "counterpartyName": "NGUYEN VAN AN" }, timeout=10,)res.raise_for_status(){ "id": "btx_01JD7QA9F3W5Y7Z1B3D5G7J9KM", "bankAccountId": "bac_01JD5A2B4C6D8E0F2G4H6J8K0M", "direction": "in", "amount": 150000, "currency": "VND", "description": "LK7F3K9 thanh toan don hang", "referenceCode": "LK7F3K9", "counterpartyName": "NGUYEN VAN AN", "counterpartyBank": "VCB", "channel": "website", "reconciliation": "matched", "matchedOrderRef": "DH-1024", "occurredAt": "2026-11-03T08:03:10Z"}/v1/test/bank_transfersĐối tượng
BankTransaction
idstringbắt buộcID giao dịch.
bankAccountIdstringbắt buộcTài khoản ngân hàng nhận tiền.
directionstringbắt buộcintiền vào ·outtiền ra.amountintegerbắt buộcSố tiền, số nguyên VND.
currency"VND"bắt buộcLuôn là
VND.descriptionstringbắt buộcNội dung chuyển khoản đúng như ngân hàng gửi.
referenceCodestring | nullbắt buộcMã tham chiếu Hensa tìm thấy trong nội dung (nếu có).
counterpartyNamestring | nullbắt buộcTên người chuyển (nếu ngân hàng cung cấp).
counterpartyBankstring | nullbắt buộcNgân hàng người chuyển (nếu có).
channelstring | nullbắt buộcKênh bán gắn với giao dịch (nếu biết).
Giá trị:
counterwebsitefacebookzalodeliveryreconciliationstringbắt buộcmatchedđã khớp ·pendingcần xử lý ·unmatchedkhông phải đơn.matchedOrderRefstring | nullbắt buộcMã đơn đã khớp (nếu có).
occurredAtstringbắt buộcThời điểm tiền vào tài khoản theo ngân hàng.
{ "id": "btx_01JD7QA9F3W5Y7Z1B3D5G7J9KM", "bankAccountId": "bac_01JD5A2B4C6D8E0F2G4H6J8K0M", "direction": "in", "amount": 150000, "currency": "VND", "description": "LK7F3K9 thanh toan don hang", "referenceCode": "LK7F3K9", "counterpartyName": "NGUYEN VAN AN", "counterpartyBank": "VCB", "channel": "website", "reconciliation": "matched", "matchedOrderRef": "DH-1024", "occurredAt": "2026-11-03T08:03:10Z"}