Payment Initiation
Personal
Business
Payment initiation API
In a company's internal payment workflow, disbursing money is usually split into two independent steps: the accountant initiates the order and the director approves it. While this process ensures financial control and safety, it is time-consuming and lacks continuity between stages.
The Payment Initiation API lets you create payment transactions from a company's bank account through an API, reducing the accounting team's workload for initiating payments and making it easy to manage corporate disbursement orders. The Cas SDK Payment Initiation API is designed to accurately mirror a company's real-world payment process while allowing flexible integration into accounting systems, ERPs, or in-house software. The Cas SDK supports:
- Initiating payment orders via API from the accountant's account
Benefits of using the Cas SDK:
- Fits the accounting and finance workflows of Vietnamese businesses
- Preserves segregation of duties and internal control, just like a company's current disbursement process
- Easy to integrate into existing systems via API, especially ERP software
Steps to Integrate Payment Initiation
Below are the steps to integrate Payment Initiation into your product.
- Create a grant /grant/token with
scopesset topayment_initiation. - Open the Cas Link interface using the
grantTokenreturned in the previous step. See details - After the user completes authentication, your frontend will receive a
publicToken. Use thispublicTokento obtain anaccessTokenfor the grant. - You can now call the Payment Initiation API.
Call API
Create access grant for 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);
});
For API details, see here
Get accessToken from 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);
});
For API details, see here
Payment Initiation API
- 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);
});
For API details, see here