Casso Developer
stable (v2)
stable (v2)
  • Tổng quan
  • Kết nối Casso bằng Webhook
    • Thiết lập Webhook thủ công
    • Xử lý sự kiện Webhook
  • Sử dụng API Casso
    • Chứng thực API
      • Tạo API Key thủ công
    • Danh sách API
      • API lấy thông tin user
      • API thiết lập webhook
      • API lấy giao dịch
      • API lấy thông tin tài khoản ngân hàng
      • API buộc đồng bộ giao dịch mới ngay
  • Tài nguyên khác
    • Tích hợp xác nhận thanh toán
    • Change log
Powered by GitBook
On this page
  • Trước khi bắt đầu
  • 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
  • Chi tiết tài khoản ngân hàng
  • Chi tiết tài khoản ngân hàng
  • 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

Was this helpful?

  1. Sử dụng API Casso
  2. Danh sách API

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 đó.

PreviousAPI lấy giao dịchNextAPI buộc đồng bộ giao dịch mới ngay

Last updated 1 year ago

Was this helpful?

Trước khi bắt đầu

Một số lưu ý trước khi bắt đầu:

  • Một tài khoản đã 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ó để thiết lập ở trường Authorization HTTP Header.

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://oauth.casso.vn/v2/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 từ Oauth2"> hoặc

Apikey <"API key của bạn">

{
    "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 --location --request GET 'https://oauth.casso.vn/v2/accounts \
--header 'Authorization: Apikey <"API Key của bạn"> hoặc Bearer <"access token từ OAuth2"'
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://oauth.casso.vn/v2/accounts",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "Authorization: Apikey <"API Key của bạn"> hoặc Bearer <"access token từ OAuth2">",
    "Content-Type: application/json"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://oauth.casso.vn/v2/accounts")
  .get()
  .addHeader("Content-Type", "application/json")
  .addHeader("Authorization", "Apikey <"API Key của bạn"> hoặc Bearer <"access token từ OAuth2">")
  .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://oauth.casso.vn/v2/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 từ Oauth2"> hoặc

Apikey <"API key của bạn">

{
    "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"
    }
}
{
    "error": 401,
    "message": "Unauthorized Access",
    "data": null
}

Ví dụ:

curl --location --request GET 'https://oauth.casso.vn/v2/accounts/123 \
--header 'Authorization: Apikey <"API Key của bạn"> hoặc Bearer <"access token từ OAuth2"'
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://oauth.casso.vn/v2/accounts/123",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "Authorization: Apikey <"API Key của bạn"> hoặc Bearer <"access token từ OAuth2">",
    "Content-Type: application/json"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://oauth.casso.vn/v2/accounts/123")
  .get()
  .addHeader("Content-Type", "application/json")
  .addHeader("Authorization", "Apikey <"API Key của bạn"> hoặc Bearer <"access token từ OAuth2">")
  .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://oauth.casso.vn/v2/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 từ Oauth2"> hoặc

Apikey <"API key của bạn">

{
    "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": ""
            },
            ...
        ]
    }
}

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 --location --request GET 'https://oauth.casso.vn/v2/accounts/123/transactions?fromDate=2021-04-01&toDate=2022-07-05&page=4&pageSize=20&sort=ASC' \
--header 'Authorization: Apikey <API Key của bạn> hoặc Bearer <access token từ OAuth2>'
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://oauth.casso.vn/v2/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: Apikey <"API Key của bạn"> hoặc Bearer <"access token từ OAuth2">",
    "Content-Type: application/json"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://oauth.casso.vn/v2/accounts/123/transactions?fromDate=2021-04-01&page=4&pageSize=20&sort=ASC")
  .get()
  .addHeader("Content-Type", "application/json")
  .addHeader("Authorization", "Apikey <"API Key của bạn"> hoặc Bearer <"access token từ OAuth2">")
  .build();

Response response = client.newCall(request).execute();

Casso
API Key