Payment Initiation
API lập lệnh
Trong quy trình thanh toán nội bộ của doanh nghiệp, việc chi tiền thường được tách thành hai bước độc lập là kế toán lập lệnh và giám đốc duyệt lệnh. Quy trình tuy đảm bảo kiểm soát và an toàn tài chính nhưng gây mất nhiều thời gian và không liền mạch giữa các giai đoạn.
API lập lệnh hỗ trợ tạo giao dịch thanh toán từ tài khoản ngân hàng của doanh nghiệp thông qua API, giúp giảm tải công việc lập lệnh thanh toán của Kế toán và dễ dàng quản lý các lệnh chi tiền doanh nghiệp. API Lập lệnh của Cas SDK được thiết kế để mô phỏng chính xác quy trình thanh toán thực tế của doanh nghiệp, đồng thời cho phép tích hợp linh hoạt vào hệ thống kế toán, ERP hoặc phần mềm nội bộ. Cas SDK hỗ trợ:
- Lập lệnh thanh toán qua API từ tài khoản kế toán
Lợi ích khi sử dụng Cas SDK
- Phù hợp quy trình kế toán – tài chính của doanh nghiệp Việt Nam
- Đảm bảo nguyên tắc phân quyền & kiểm soát nội bộ như quy trình chi tiền DN hiện tại
- Dễ dàng tích hợp vào hệ thống hiện có qua API, đặc biệt là các phần mềm ERP
Các bước tích hợp Payment Initiation
Dưới đây là các bước để tích hợp Payment Initiation vào sản phẩm của bạn.
- Tạo một phân quyền /grant/token với scopes có giá trị là
payment_initiation - Mở giao diện Cas Link bằng grantToken được trả về ở bước trên. Xem chi tiết
- Sau khi người dùng hoàn tất xác thực, phía giao diện của bạn sẽ nhận được một publicToken, dùng publicToken này để lấy accessToken cho phân quyền.
- Bây giờ bạn đã có thể gọi API lập lệnh.
Gọi API
Tạo phân quyền cho Pay Out
- CURL
- Javascript (Axios)
curl --location 'https://sandbox.bankhub.dev/grant/token' \
--header 'X-BankHub-Api-Version: 2023-01-01' \
--header 'x-client-id: <CLIENT_ID_HERE>' \
--header 'x-secret-key: <SECRET_KEY_HERE>' \
--header 'Content-Type: application/json' \
--data '{
"scopes": "payment_initiation",
"language": "vi",
"redirectUri": "https://your-domain.vn/link",
}'
const axios = require('axios');
const data = JSON.stringify({
"scopes": "payment_initiation",
"language": "vi",
"redirectUri": "https://your-domain.vn/link",
});
const config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://sandbox.bankhub.dev/grant/token',
headers: {
'X-BankHub-Api-Version': '2023-01-01',
'x-client-id': '<CLIENT_ID_HERE>',
'x-secret-key': '<SECRET_KEY_HERE>',
'Content-Type': 'application/json',
},
data: data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
Xem chi tiết API, tại đây
Lấy accessToken từ publicToken
- CURL
- Javascript (Axios)
curl --location 'https://sandbox.bankhub.dev/grant/exchange' \
--header 'X-BankHub-Api-Version: 2023-01-01' \
--header 'x-client-id: <CLIENT_ID_HERE>' \
--header 'x-secret-key: <SECRET_KEY_HERE>' \
--header 'Content-Type: application/json' \
--data '{
"publicToken": "bdbde2bad-7685-4f95-987c-71309a4a3"
}'
const axios = require('axios');
const data = JSON.stringify({
"publicToken": "bdbde2bad-7685-4f95-987c-71309a4a3"
});
const config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://sandbox.bankhub.dev/grant/exchange',
headers: {
'X-BankHub-Api-Version': '2023-01-01',
'x-client-id': '<CLIENT_ID_HERE>',
'x-secret-key': '<SECRET_KEY_HERE>',
'Content-Type': 'application/json'
},
data: data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
Xem chi tiết API, tại đây
API lập lệnh
- CURL
- Javascript (Axios)
curl --location 'https://sandbox.bankhub.dev/payment-initiation' \
--header 'X-BankHub-Api-Version: 2023-01-01' \
--header 'Authorization: <ACCESS_TOKEN_HERE>' \
--header 'x-client-id: <CLIENT_ID_HERE>' \
--header 'x-secret-key: <SECRET_KEY_HERE>'
--header 'x-interaction-id: ebcccee7-b5c6-4990-994b-fccf01320e54' \
--data '{
"amount": 10000,
"fromAccountNumber": "000",
"toBin": "970415",
"toAccountNumber": "113366668888",
"description": "CK"
}'
const axios = require('axios');
const data = JSON.stringify({
"amount": 10000,
"fromAccountNumber": "000",
"toBin": "970415",
"toAccountNumber": "113366668888",
"description": "CK"
});
const config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://sandbox.bankhub.dev/payment-initiation',
headers: {
'X-BankHub-Api-Version': '2023-01-01',
'Authorization': '<ACCESS_TOKEN_HERE>',
'x-client-id': '<CLIENT_ID_HERE>',
'x-secret-key': '<SECRET_KEY_HERE>',
'x-interaction-id': 'ebcccee7-b5c6-4990-994b-fccf01320e54',
},
data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
Xem chi tiết API, tại đây