Comment on page
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.
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 hoặc Access token từ Oauth 2.0 của Casso để thiết lập ở trường Authorization HTTP Header.
get
https://oauth.casso.vn
/v2/userInfo
Lấy thông tin user
CURL
PHP
JAVA
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": "[email protected]"
},
"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.Last modified 2yr ago