E-Invoice
Easily Create E-Invoices – Instant Financial Transparency
Cas E-Invoice API enables you to create e-invoices quickly, accurately, and automatically, simplifying accounting processes and ensuring compliance with financial regulations.
You can:
- Generate invoices directly from transactions or sales data
- Send e-invoices to buyers via email or shareable links
- Sync invoice data for tax and accounting reports
- Ensure transparency and easy reconciliation in all financial operations
Steps to Integrate Invoice
Below are the steps to integrate Invoice into your product.
-
Create a grant /grant/token with
scopes
set toinvoice
. -
Open the Cas Link interface using the
grantToken
returned from the step above. See details -
After the user completes authentication, your frontend will receive a
publicToken
. Use thispublicToken
to obtain anaccessToken
for the grant. -
You can now call the Create Invoice API.
Call API
Create grant for E-Invoice
- 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": "invoice",
"language": "vi",
"redirectUri": "https://your-domain.vn/link",
}'
const axios = require('axios');
const data = JSON.stringify({
"scopes": "invoice",
"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);
});
info
For detail API, here
Exchange publicToken for accessToken
- 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);
});
info
For detail API, here
Creation API
- CURL
- Javascript (Axios)
curl --location 'https://sandbox.bankhub.dev/invoices' \
--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>'
--data-raw '{
"invoiceCreationType": "ISSUED",
"invoiceType": "1",
"templateCode": "1/247",
"invoiceSeries": "K24TSA",
"currencyCode": "VND",
"adjustmentType": "1",
"paymentStatus": true,
"invoiceIssuedDate": 1749001176000,
"validation": 0,
"buyerInfo": {
"buyerNotGetInvoice": 0,
"buyerName": "Nguyen Van A",
"buyerLegalName": "CASSO COMPANY LIMITED",
"buyerTaxCode": "0316794479",
"buyerAddressLine": "I.102D, Nhà A, Khu Công Nghệ Phần Mềm, Đường Nội Bộ Đại học Quốc Gia Thành Phố Hồ Chí Minh, Khu phố 6, Phường Linh Trung, Thành phố Thủ Đức, Thành phố Hồ Chí Minh, Việt Nam",
"buyerEmail": "[email protected]"
},
"taxBreakdowns": {
"taxPercentage": -2,
},
"items": [
{
"itemTotalAmountWithoutTax": 10000,
"itemName": "ABC",
"unitName": "package",
"unitPrice": 10000,
"quantity": 1
}
],
"payments": [
{
"paymentMethod": "3",
"paymentMethodName": "TM/CK"
}
]
}'
const axios = require('axios');
let data = JSON.stringify({
"invoiceCreationType": "ISSUED",
"invoiceType": "01GTKT",
"templateCode": "1/247",
"invoiceSeries": "K24TSA",
"currencyCode": "VND",
"adjustmentType": "1",
"paymentStatus": true,
"invoiceIssuedDate": 0,
"buyerInfo": {
"buyerNotGetInvoice": false,
"buyerName": "Nguyen Van A",
"buyerLegalName": "CASSO COMPANY LIMITED",
"buyerTaxCode": "0316794479",
"buyerAddressLine": "I.102D, Nhà A, Khu Công Nghệ Phần Mềm, Đường Nội Bộ Đại học Quốc Gia Thành Phố Hồ Chí Minh, Khu phố 6, Phường Linh Trung, Thành phố Thủ Đức, Thành phố Hồ Chí Minh, Việt Nam",
"buyerEmail": "[email protected]"
},
"taxBreakdowns": {
"taxPercentage": 0,
"taxAmount": 0,
"taxableAmount": 0
},
"items": [
{
"itemTotalAmountWithoutTax": 10000,
"taxAmount": 0,
"itemName": "ABC",
"unitName": "package",
"unitPrice": 10000,
"quantity": 1
}
],
"payments": [
{
"paymentMethod": "3",
"paymentMethodName": "TM/CK"
}
],
"validation": 0
});
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://sandbox.bankhub.dev/invoices',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'x-client-id': '<x-client-id>',
'x-secret-key': '<x-client-id>',
'Authorization': '<x-client-id>'
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
info
For detail API, here