Tài liệu API V2. Phiên bản này dừng từ 31/12/2026. Bản đang dùng là V3.

API lấy thông tin user

Dùng để lấy thông tin người dùng như: thông tin tài khoản, thông tin doanh nghiệp, danh sách các ngân hàng liên kết.

Trước khi bắt đầu

Một số lưu ý trước khi bắt đầu với các API liên quan tới webhook:

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

Lấy thông tin user

GET https://oauth.casso.vn/v2/userInfo

Lấy chi tiết thông tin tài khoản như: email, thông tin doanh nghiệp và thông tin 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>

200 Cake successfully retrieved.

{
    "error": 0,
    "message": "success",
    "data": {
        "user": {
            "id": 1553,
            "email": "haonh@magik.vn"
        },
        "business": {
            "id": 1540,
            "name": "Hữu Hảo"
        },
        "bankAccs": [
            {
                "id": 69,
                "bank": {
                    "bin": 970416,
                    "codeName": "acb_digi"
                },
                "bankAccountName": null,
                "bankSubAccId": "17271687",
                "connectStatus": 1,
                "planStatus": 1
            },
            {
                "id": 63,
                "bank": {
                    "bin": 970454,
                    "codeName": "timoplus"
                },
                "bankAccountName": null,
                "bankSubAccId": "8007041023848",
                "connectStatus": 1,
                "planStatus": 0
            }
        ]
    }
}

401 Could not find a cake matching this query.

{
    "error": 401,
    "message": "Unauthorized Access",
    "data": null
}

Ví dụ:

CURL

curl --location --request GET 'https://oauth.casso.vn/v2/userInfo' \
--header 'Authorization: Apikey <API Key của bạn> hoặc Bearer <access token từ OAuth2>'

PHP

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://oauth.casso.vn/v2/userInfo",
  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);

JAVA

OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://oauth.casso.vn/v2/userInfo")
  .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();

Ví dụ mẫu

curl --location --request GET 'https://oauth.casso.vn/v2/userInfo' \
--header 'Authorization: Apikey AK_CS.0cf673d0406711ecb6579fe89ca48437.WT2EHXBpzTFpA2XBBJzuBJSGkIPJxtM8ShgSe059Wh2SDKmAkoueFdkqnjZJrUnEXj2F2CX2'

Kết quả trả về

{
    "error": 0,
    "message": "success",
    "data": {
        "user": {
            "id": 1,
            "email": "demo@casso.vn"
        },
        "business": {
            "id": 1009,
            "name": "VinDemo"
        },
        "bankAccs": [
            {
                "id": 87,
                "bank": {
                    "bin": 970436,
                    "codeName": "vietcombank"
                },
                "bankAccountName": null,
                "bankSubAccId": "123456789",
                "balance": 64875755,
                "memo": "VCB NGUYEN VAN A23",
                "connectStatus": 1,
                "planStatus": 2
            }
            //... các tài khác tiếp theo
        ]
    }
}

Mẹo: Bạn có thể sử dụng thông tin phản hồi của API này trong trường bankAccs để có thể tạo cho mình các mã VietQR code tương ứng với các thông tin phản hồi này.