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
  • Lấy thông tin user

Was this helpful?

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

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.

PreviousDanh sách APINextAPI thiết lập webhook

Last updated 2 months ago

Was this helpful?

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

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>

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

Ví dụ:

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>'
$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);
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ã tương ứng với các thông tin phản hồi này.

Casso
API Key
VietQR code