API lấy thông tin tài khoản ngân hàng
Truy vấn một hoặc nhiều tài khoản ngân hàng đã kết nối và danh sách giao dịch của tài khoản đó.
Trước khi bắt đầu
Một số lưu ý trước khi bắt đầu:
- Một tài khoản Casso Flow đã liên kết một tài khoản ngân hàng. Để test với API này có thể sử dụng tài khoản demo.
- Bạn cần có access token để gửi trong trường Authorization.
Danh sách tài khoản ngân hàng
Lấy danh sách các tài khoản ngân hàng
GET https://openapi.casso.vn/flow/v3/accounts
Truy vấn danh sách các tài khoản ngân hàng đã liên kết
Headers
| Name | Type | Description |
|---|---|---|
| Authorization* | String | Bearer <access_token> |
200: OK Thành công
{
"error": 0,
"message": "Successful",
"data": [
{
"id": 123,
"accountNumber": "8007041027107",
"accountName": "NGUYEN MINH KHANH",
"accountType": "",
"balance": 0,
"currency": "VND",
"swift": "",
"citad": "",
"serviceType": "personal",
"bankName": "Timo Plus by Viet Capital Bank",
"BIN": 970454,
"bankCodeName": "timoplus",
"memo": "",
"connectStatus": 1,
"beginningSettingDate": "2020-08-01",
"beginningTxnDate": null,
"beginningBalance": 0,
"creditTxnTotal": 546403683,
"creditTxnAmount": 0,
"debitTxnTotal": 0,
"debitTxnAmount": 0,
"lockSyncDate": null,
"endingBalance": 0,
"endingTxnDate": "2023-01-05T00:00:00Z"
},
...
]
}
Ví dụ:
CURL
curl --location --request GET 'https://openapi.casso.vn/flow/v3/accounts \
--header 'Authorization: Bearer <access_token>'
PHP
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://openapi.casso.vn/flow/v3/accounts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Authorization: Bearer <access_token>",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
JAVA
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://openapi.casso.vn/flow/v3/accounts")
.get()
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer <access_token>")
.build();
Response response = client.newCall(request).execute();
Chi tiết tài khoản ngân hàng
Chi tiết tài khoản ngân hàng
GET https://openapi.casso.vn/flow/v3/accounts/:accountId
Truy vấn chi tiết tài khoản ngân hàng đã liên kết.
Path Parameters
| Name | Type | Description |
|---|---|---|
| accountId* | Number | Mã định danh của tài khoản ngân hàng |
Headers
| Name | Type | Description |
|---|---|---|
| Authorization* | String | Bearer <access_token> |
200 Thành công
{
"error": 0,
"message": "Successful",
"data": {
"id": 122,
"accountNumber": "8007041027107",
"accountName": "NGUYEN MINH KHANH",
"accountType": "",
"balance": 123,
"currency": "VND",
"swift": "",
"citad": "",
"serviceType": "personal",
"bankName": "Timo Plus by Viet Capital Bank",
"BIN": 970454,
"bankCodeName": "timoplus",
"memo": "",
"connectStatus": 1,
"beginningSettingDate": "2020-08-01",
"beginningTxnDate": null,
"beginningBalance": 0,
"creditTxnTotal": 546403683,
"creditTxnAmount": 0,
"debitTxnTotal": 0,
"debitTxnAmount": 0,
"lockSyncDate": null,
"endingBalance": 0,
"endingTxnDate": "2023-01-05T00:00:00Z"
}
}
401 Unauthorized
{
"error": 401,
"message": "Unauthorized Access",
"data": null
}
Ví dụ:
CURL
curl --location --request GET 'https://openapi.casso.vn/flow/v3/accounts/123 \
--header 'Authorization: Bearer <access_token>'
PHP
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://openapi.casso.vn/flow/v3/accounts/123",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Authorization: Bearer <access_token>",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
JAVA
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://openapi.casso.vn/flow/v3/accounts/123")
.get()
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer <access_token>")
.build();
Response response = client.newCall(request).execute();
Danh sách giao dịch ngân hàng
Danh sách giao dịch của một tài khoản ngân hàng
GET https://openapi.casso.vn/flow/v3/accounts/:accountId/transactions
Truy vấn danh sách giao dịch ngân hàng của một tài khoản đã liên kết.
Path Parameters
| Name | Type | Description |
|---|---|---|
| accountId* | Number | Mã định danh tài khoản |
Query Parameters
| Name | Type | Description |
|---|---|---|
| sort | String | Sắp xếp tăng hoặc giảm dần dựa theo thời gian của giao dịch. Mặc định là ASC(tăng dần). |
| pageSize | String | Số lượng giao dịch trên một trang |
| page | Number | Số thứ tự của trang |
| fromDate | String | Lấy giao dịch ngày bắt đầu. Định dạng: YYYY-MM-DD |
| toDate | String | Lấy giao dịch ngày kết thúc. Định dạng: YYYY-MM-DD |
Headers
| Name | Type | Description |
|---|---|---|
| Authorization* | String | Bearer <access_token> |
200 Thành công
Response theo page
{
"error": 0,
"message": "success",
"data": {
"page": 4,
"pageSize": 10,
"nextPage": 5,
"prevPage": 3,
"totalPages": 35,
"totalRecords": 341,
"records": [
{
"privateId": 199,
"reference": "TF2104042",
"bookingDate": "2021-04-04",
"transactionDate": "2021-04-04",
"transactionDateTime": "2021-04-04T21:10:00Z",
"amount": -1000000,
"description": "RUT TM TU ATM",
"runningBalance": 23502022,
"virtualAccountNumber": "",
"virtualAccountName": "",
"paymentChannel": "",
"counterAccountNumber": "",
"counterAccountName": "",
"counterAccountBankId": "",
"counterAccountBankName": ""
},
...
]
}
}
401 Unauthorized
Chi tiết các tham số
| Tham số | Mô tả | Gá trị mặc định |
|---|---|---|
| fromDate | Thời gian bắt đầu bạn muốn lấy giao dịch | 7 ngày gần nhất |
| toDate | Thời gian kết thúc bạn muốn lấy giao dịch | Hôm nay |
| page | Số thứ tự trang | 1 |
| pageSize | Số giao dịch trên một trang | 10 |
| sort | Sắp xếp giao dịch, các giá trị gồm: ASC, DESC. Với ASC là tăng dần còn DESC là giảm dần. | ASC |
- Nếu tham số nào không tồn tại thì sẽ lấy giá trị mặc định.
- Xem chi tiết các trường của một giao dịch, xem chi tiết
Ví dụ:
CURL
curl --location --request GET 'https://openapi.casso.vn/flow/v3/accounts/123/transactions?fromDate=2021-04-01&toDate=2022-07-05&page=4&pageSize=20&sort=ASC' \
--header 'Authorization: Bearer <access_token>'
PHP
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://openapi.casso.vn/flow/v3/accounts/123/transactions?fromDate=2021-04-01&page=4&pageSize=20&sort=ASC",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Authorization: Bearer <access_token>",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
JAVA
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://openapi.casso.vn/flow/v3/accounts/123/transactions?fromDate=2021-04-01&page=4&pageSize=20&sort=ASC")
.get()
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer <access_token>")
.build();
Response response = client.newCall(request).execute();