NAV
bash javascript

Giới thiệu

Bảo Kim Authentication service cung cấp quy trình và các API phục vụ việc tích hợp Oauth2 cũng như Single Sign-on nhằm phục vụ việc đăng ký, đăng nhập, xác thực người dùng và hơn thế nữa.

API endpoint

Bảo Kim API endpoint (đường dẫn đầy đủ gọi API) được xác định như sau:

Môi trường production (thật)

Trong đó API_URI được mô tả trong phần tài liệu chi tiết của từng API

Phương thức bảo mật

Xem chi tiết Phương thức bảo mật Bảo Kim API tại đây

Đăng ký client site

Để tiến hành tích hợp Oauth2 & Single Sign-on, Client cần đăng ký với Bảo Kim trước như sau:

Tích hợp OAuth2

Quy trình login password flow

Bảo Kim OAuth2 tuân theo chuẩn Open Authentication 2.0.

Bảo kim cung cấp các API và quy trình cho phép tích hợp đăng ký, đăng nhập, ... trên https://vnid.net

Dưới đây là quy trình tích hợp Oauth2 với mode Password flow (dành cho các ứng dụng nội bộ)

Quy trình tích hợp OAuth2 password flow

Quy trình login Facebook/Google

VNID.net hỗ trợ client tích hợp login qua Facebook/Google với quy trình như sau

Cách 1(chỉ dùng với trường hợp là website và đã tích hợp SSO)

Cách 2

Quy trình tích hợp OAuth2 login Facebook/Google

Mô tả quy trình

  1. Khi người dùng phát sinh yêu cầu đăng nhập qua Facebook/Google, đối tác tiến hành thực hiện đăng nhập tại app/website của mình.
  2. Khi đăng nhập thành công, đối tác sẽ nhận được access_token của user từ Facebook/Google trả về.
  3. Đối tác gọi API lấy thông tin user từ access_token
  4. API sẽ trả về thông tin user đã được đăng nhập trên https://vnid.net và kèm theo access_token, refresh_token, ticket. Đối tác thiết lập trạng thái đăng nhập bằng access_tokenrefresh_token mới nhận được.
  5. Đối tác sẽ chuyển trang sang https://vnid.net/sso?ticket=xxx&return_url=xxx.
    • Tham số ticket là tham số nhận được từ bước 4.
    • Tham số return_url sẽ là url mà đối tác muốn trình duyệt của người dùng trở về sau khi SSO (sử dụng base64 encode).
  6. Hiển thị kết quả đăng nhập cho người dùng

Tích hợp Single Sign-on (SSO)

Quy trình sso login

Quy trình Baokim SSO Login

Lưu ý: Để tích hợp được SSO, đối tác phải tích hợp OAuth2 và khai báo 1 url thiết lập trạng thái đăng nhập (sso_callback) trên hệ thống của đối tác với Bảo kim.

Mô tả quy trình

  1. Khi người dùng phát sinh yêu cầu đăng nhập, đối tác gọi API Login để tiến hành đăng nhập qua OAuth2.
    • Đối tác sẽ nhận được response là thông tin người dùng, access_token, refresh_tokenticket.
  2. Đối tác có thể thiết lập trạng thái đăng nhập tại bước này nếu muốn và chuyển trang sang trang: https://vnid.net/sso?ticket=xxx&return_url=xxx.
    • Tham số ticket là tham số nhận được từ API Login.
    • Tham số return_url sẽ là url mà đối tác muốn trình duyệt của người dùng trở về sau khi đăng nhập (base64 encode)
  3. Đối tác phải khai báo 1 url thiết lập trạng thái đăng nhập sso (sso_callback) trên hệ thống của đối tác với Bảo kim.
    • Bảo kim sẽ request đến url sso_callback với method http GET, kèm theo tham số authorization_code
    • Tham số authorization_code dùng để lấy access_token, refresh_token đang đăng nhập trên hệ thống Bảo kim
  4. Bảo Kim sẽ tiến hành request đến link sso_callback của đối tác kèm theo authorization_code (https://example.com/sso-callback?authorization_code=xxx)
  5. Đối tác tiến hành gọi API để lấy access_token, refresh_token với tham số authorization_code ở bước 3 qua API /oauth/token như sau:
    • Endpoint: https://api.baokim.vn/auth/oauth/token
    • Method: POST
    • Params: grant_type=authorization_code/client_id/client_secret/redirect_uri/code (authorization_code)
    • Response: {token_type: "Bearer", expires_in: "seconds", access_token: "---", refresh_token: "---"}
  6. Trên sso_callback đã khai báo, đối tác thiết lập các trạng thái đăng nhập cho người dùng trên site đối tác
  7. Sau khi hoàn thành các nghiệp vụ trên, đối tác phải response trên sso_callback khai báo định dạng 1 ảnh trắng kích thước 1*1px

Quy trình sso logout

Quy trình Baokim SSO Logout

Mô tả quy trình:

  1. User click link logout trên website client
  2. Client set trạng thái logout
  3. Client redirect trình duyệt sang link sso logout kèm return_url của VNID.net: https://vnid.net/sso/logout?return_url=***
  4. VNID.net render trang sso logout page, request sso callback đến tất cả các client khác với tham số ?action=logout
  5. Các Client khác set logout stat cho user (phân biệt login và logout bằng action, nếu không có action thì mặc định là login)
  6. VNID.net redirect trình duyệt user theo tham số return_url để quay lại trang Client

Callback cập nhập thông tin người dùng

Để nhận được callback khi người dùng thực hiện cập nhập thông tin trên https://vnid.net, đối tác cần làm theo những bước sau

  1. Đăng ký link nhận callback.
  2. Bảo Kim sẽ tiến hành gửi dữ liệu người dùng kèm sign để đối tác kiểm tra và xử lý:
    • Dữ liệu sẽ là dạng JSON {oldData:xxx, newData:xxx, sign:xxx}
    • Chữ ký sẽ được mã hóa theo dạng HMAC SHA-256 với dữ liệu là JSON {oldData:xxx, newData:xxx} và key là secret Bảo Kim đã cung cấp cho đối tác.
  3. Đối tác tiến hành mã hóa dữ liệu oldDatanewData kèm theo secret để kiểm tra tính toàn vẹn của dữ liệu.
  4. Cập nhập thông tin người dùng theo newData.

Auth APIs

Login

[Đăng nhập user dùng username và password.]

Example request:

curl -X POST "https://api.baokim.vn/auth/api/v4/user/login" \
    -H "Authorization: Bearer: {accessToken}" \
    -H "Content-Type: application/json" \
    -d "username"="quo" \
    -d "password"="harum" \
    -d "client_id"="beatae" \
    -d "grant_type"="tenetur" \
    -d "client_secret"="impedit" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/auth/api/v4/user/login",
    "method": "POST",
    "data": {
        "username": "quo",
        "password": "harum",
        "client_id": "beatae",
        "grant_type": "tenetur",
        "client_secret": "impedit"
    },
    "headers": {
        "Authorization": "Bearer: {accessToken}",
        "Content-Type": "application/json",
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});

Example response:

[
    {
        "status": 200,
        "content": "{\n\"code\": 1,\n\"msg\": \"thành công\",\n\"count\": 1,\n\"data\": {\n\"id\": 1000947,\n\"name\": \"Tran Vu Hoang\",\n\"phone\": \"84975711361\",\n\"email\": \"hoangtv.hn89@gmail.com\",\n\"type\": 1,\n\"stat\": 2,\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-jq-6mlqL7IZkdkgLcBXdn03hYR8FHWGpQQwpJZGRihSTuIqy-uFED-wQS7VLTSQGcgyvEwJZDUjJ2TjONSH0IekNB4_itDYq9bJUGJbSjbw2g_evktduQeTa-8tyjo\",\n\"refresh_token\": \"def502008e3602c807d009ca5a970726f3b5cc4717b597d3bc5b17fc73225dbc6ff007e298f5dbfa46f32f5011bfcd37475723ec38d2af3e23c0e4eef6287ee6ad65de13beb154186fdb7fcc6f2317b10e6e2b5ac4792378eed9fc5358331df8deec73039a442ec8f768e9da673c908458823c46eadd7548e5fc35a0f9634e38aa8f115437d7bba3445bcddbd01d0ddcec30b45a55aa137713bbfb3ea1f8f95a838b7970021d2c2294bc689ffdb15cb447ead1438fa3b31ce02005b4cc5634a93d9a1529339993b93d8b3deb0a54231c106f247a4e5d845be735c71e0a530420ce627ecf71414e2d8653c48850e61ffcd5fbec86f3aeeba09c723144c942dc631236b0a7b856e6d7d557dd08f1ad8f98023ef9d3b27a303adeee4d796b72737bf67b99d998236ff989bd8169e92643a248533d105617f232fe758fd0e7cb6df338d2b7705f069f69de3ea3f3ec0bf6022e81512bb77c8f19204e586ebe8c08f8c37493fb9fd5d9\",\n\"ticket\":\n\"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6ImRhMDMzMDhmMDZmOTc0OGRmYzUyMjA5YWNlNjMwYmQxNWMzYzYzZDAwNDNhYmNmMmM1NjJiNjdmOWYwMDEyYTBkZDJkMzI0MjQ4MjA4MGM5In0.eyJhdWQiOiIxIiwianRpIjoiZGEwMzMwOGYwNmY5NzQ4ZGZjNTIyMDlhY2U2MzBiZDE1YzNjNjNkMDA0M2FiY2YyYzU2MmI2N2Y5ZjAwMTJhMGRkMmQzMjQyNDgyMDgwYzkiLCJpYXQiOjE1NDA0MzU0MDEsIm5iZiI6MTU0MDQzNTQwMSwiZXhwIjoxNTcxOTcxNDAxLCJzdWIiOiI0Iiwic2NvcGVzIjpbXX0\"\n}\n}"
    }
]

HTTP Request

POST api/v4/user/login

Body Parameters

Parameter Type Status Description
username string required Tên đăng nhập.
password string required Mật khẩu.
client_id string required Mã client (cấp bởi Bảo kim).
grant_type string required password.
client_secret string required Mã bảo mật (cấp bởi Bảo kim) .

Logout (Revoke access_token)

[Thu hồi access_token để xác lập trạng thái đăng xuất]

Example request:

curl -X POST "https://api.baokim.vn/auth/api/v4/user/logout" \
    -H "Authorization: Bearer: {accessToken}"
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/auth/api/v4/user/logout",
    "method": "POST",
    "headers": {
        "Authorization": "Bearer: {accessToken}",
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});

Example response:

[
    {
        "status": 200,
        "content": "{\n\"code\": 0,\n\"message\": [],\n\"count\": 0,\n\"data\": []\n}"
    }
]

HTTP Request

POST api/v4/user/logout

Refresh login token

[Sử dụng Refresh token để gia hạn thời gian đăng nhập (tạo access_token mới có thởi hạn lâu hơn)]

Example request:

curl -X POST "https://api.baokim.vn/auth/api/v4/user/refresh-token" \
    -H "Authorization: Bearer: {accessToken}" \
    -H "Content-Type: application/json" \
    -d "refresh_token"="non" \
    -d "client_id"="dicta" \
    -d "grant_type"="et" \
    -d "client_secret"="voluptates" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/auth/api/v4/user/refresh-token",
    "method": "POST",
    "data": {
        "refresh_token": "non",
        "client_id": "dicta",
        "grant_type": "et",
        "client_secret": "voluptates"
    },
    "headers": {
        "Authorization": "Bearer: {accessToken}",
        "Content-Type": "application/json",
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});

Example response:

[
    {
        "status": 200,
        "content": "{\n\"code\": 1,\n\"msg\": \"thành công\",\n\"count\": 1,\n\"data\": {\n\"token_type\": \"Bearer\",\n\"expires_in\": 899,\n\"access_token\": \"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjhjZGUwZTBmODMzMjU4M2Q5NmYzMzgzZmZmN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f5dbfa46f32f5011bfcd37475723ec38d2af3e23c0e4eef6287ee6ad65de13beb154186fdb7fcc6f2317b10e6e2b5ac4792378eed9fc5358331df8deec73039a442ec8f768e9da673c908458823c46eadd7548e5fc35a0f9634e38aa8f115437d7bba3445bcddbd01d0ddcec30b45a55aa137713bbfb3ea1f8f95a838b7970021d2c2294bc689ffdb15cb447ead1438fa3b31ce02005b4cc5634a93d9a1529339993b93d8b3deb0a54231c106f247a4e5d845be735c71e0a530420ce627ecf71414e2d8653c48850e61ffcd5fbec86f3aeeba09c723144c942dc631236b0a7b856e6d7d557dd08f1ad8f98023ef9d3b27a303adeee4d796b72737bf67b99d998236ff989bd8169e92643a248533d105617f232fe758fd0e7cb6df338d2b7705f069f69de3ea3f3ec0bf6022e81512bb77c8f19204e586ebe8c08f8c37493fb9fd5d9\"\n}\n}"
    }
]

HTTP Request

POST api/v4/user/refresh-token

Body Parameters

Parameter Type Status Description
refresh_token string required refresh token code.
client_id string required Mã client (cấp bởi Laravel Passport).
grant_type string required refresh_token.
client_secret string required Mã bảo mật (cấp bởi Laravel Passport) .

Login by access code

[Sử dụng access_code nhận được từ sso callback để lấy access_token, refresh_token và thông tin người dùng]

Example request:

curl -X POST "https://api.baokim.vn/auth/api/v4/sign-in-by-access-code" \
    -H "Authorization: Bearer: {accessToken}" \
    -H "Content-Type: application/json" \
    -d "access_code"="occaecati" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/auth/api/v4/sign-in-by-access-code",
    "method": "POST",
    "data": {
        "access_code": "occaecati"
    },
    "headers": {
        "Authorization": "Bearer: {accessToken}",
        "Content-Type": "application/json",
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});

Example response:

[
    {
        "status": 200,
        "content": "{\n\"code\": 0,\n\"message\": [],\n\"count\": 0,\n\"data\": {\n\"id\": 1000947,\n\"name\": \"Tran Vu Hoang\",\n\"phone\": \"84975711361\",\n\"email\": \"hoangtv.hn89@gmail.com\",\n\"access_token\": \"e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-KVIJG-7rHT1ZkaVU\",\n\"refresh_token\": \"def502008e3602c807d009ca5a970726f3b5cc4717b597d3bc5b17fc73225dbc6ff007e298f5dbfa46f32f5011bfcd37475723ec38d2af3e23c0e4eef6287ee6ad65de13beb154186fdb7fcc6f2317b10e6e2b5ac4792378eed9fc5358331df8deec73039a442ec8f768e9da673c908458823c46eadd7548e5fc35a0f9634e38aa8f115437d7bba3445bcddbd01d0ddcec30b45a55aa137713bbfb3ea1f8f95a838b7970021d2c2294bc689ffdb15cb447ead1438fa3b31ce02005b4cc5634a93d9a1529339993b93d8b3deb0a54231c106f247a4e5d845be735c71e0a530420ce627ecf71414e2d8653c48850e61ffcd5fbec86f3aeeba09c723144c942dc631236b0a7b856e6d7d557dd08f1ad8f98023ef9d3b27a303adeee4d796b72737bf67b99d998236ff989bd8169e92643a248533d105617f232fe758fd0e7cb6df338d2b7705f069f69de3ea3f3ec0bf6022e81512bb77c8f19204e586ebe8c08f8c37493fb9fd5d9\"\n}\n}"
    }
]

HTTP Request

POST api/v4/sign-in-by-access-code

Body Parameters

Parameter Type Status Description
access_code string required access_code nhận từ callback

Liên kết ví APIs

Gửi yêu cầu liên kết ví

[API gửi yêu cầu liên kết với ví Bảo Kim]

Example request:

curl -X POST "https://api.baokim.vn/auth/api/v4/linked-wallet/v2/request-linked" \
    -H "Authorization: Bearer: {accessToken}" \
    -H "Content-Type: application/json" \
    -d "mrc_uuid"="dolor" \
    -d "phone"="explicabo" \
    -d "name"="et" \
    -d "type"="1" \
    -d "business_name"="minima" \
    -d "business_number"="eius" \
    -d "site_url"="https://www.24h.com.vn" \
    -d "business_area_id"="16" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/auth/api/v4/linked-wallet/v2/request-linked",
    "method": "POST",
    "data": {
        "mrc_uuid": "dolor",
        "phone": "explicabo",
        "name": "et",
        "type": 1,
        "business_name": "minima",
        "business_number": "eius",
        "site_url": "https:\/\/www.24h.com.vn",
        "business_area_id": 16
    },
    "headers": {
        "Authorization": "Bearer: {accessToken}",
        "Content-Type": "application/json",
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});

Example response:

[
    {
        "status": 200,
        "content": "{\n\"code\": 0,\n\"msg\": [],\n\"count\": 0,\n\"data\": {\n\"ticket\": \"NmVESFNPcHdKK3JMdEQ5WDZxUmZQb3BNcjJ6N04rZWlXeVNwekViTzF4UWJTNk02VldzRzdBK3BKeU9ZdkFsekh0YXF5d0lCZlZDb3NYaUpoZmJsb3c9PQ==\"\n}\n}"
    }
]

HTTP Request

POST api/v4/linked-wallet/v2/request-linked

Body Parameters

Parameter Type Status Description
mrc_uuid string required ID User bên phía Merchant
phone numeric required Số điện thoại của User (dạng 84xxxxx)
name string required Tên của User
type integer optional Chỉ được chọn 1 hoặc 2. Mặc định là 1.Type 1 là cá nhân, 2 là doanh nghiệp
business_name string optional Tên doanh nghiệp.Nếu type là 2 thì bắt buộc điền
business_number string optional Số đăng ký kinh doanh/Mã số thuế. Nếu type là 2 thì bắt buộc điền
site_url string optional Website doanh nghiệp. Nếu type là 2 thì bắt buộc điền
business_area_id integer optional Lĩnh vực kinh doanh. Nếu type là 2 thì bắt buộc điền

Xác thực liên kết

[User submit xác thực OTP liên kết ví tạo linked code]

Example request:

curl -X POST "https://api.baokim.vn/auth/api/v4/linked-wallet/v2/submit-linked-wallet" \
    -H "Authorization: Bearer: {accessToken}" \
    -H "Content-Type: application/json" \
    -d "mrc_uuid"="et" \
    -d "otp"="aut" \
    -d "ticket"="quae" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/auth/api/v4/linked-wallet/v2/submit-linked-wallet",
    "method": "POST",
    "data": {
        "mrc_uuid": "et",
        "otp": "aut",
        "ticket": "quae"
    },
    "headers": {
        "Authorization": "Bearer: {accessToken}",
        "Content-Type": "application/json",
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});

Example response:

[
    {
        "status": 200,
        "content": "{\n\"code\": 0,\n\"message\": [],\n\"count\": 0,\n\"data\": {\n\"linked_code\": \"YlFkT3RXdjZuY1V3dFdmbFlNeFRyWEU2Y2pXV1dpNkNGUWdpN0ZrU1NjUldmRzFKQ1NYV0lHcXd0K2JPYUkzYTBRZnBZZHlCWFk0PQ==\"\n}\n}"
    }
]

HTTP Request

POST api/v4/linked-wallet/v2/submit-linked-wallet

Body Parameters

Parameter Type Status Description
mrc_uuid string required ID User bên phía Merchant
otp numeric required OTP
ticket string required Mã ticket Bảo Kim trả về ở bước 1

Xác thực linked code

[API xác thực liên kết với ví Bảo Kim qua linked_code để nhận token]

Example request:

curl -X POST "https://api.baokim.vn/auth/api/v4/linked-wallet/v2/verify-linked" \
    -H "Authorization: Bearer: {accessToken}" \
    -H "Content-Type: application/json" \
    -d "mrc_uuid"="aut" \
    -d "linked_code"="optio" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/auth/api/v4/linked-wallet/v2/verify-linked",
    "method": "POST",
    "data": {
        "mrc_uuid": "aut",
        "linked_code": "optio"
    },
    "headers": {
        "Authorization": "Bearer: {accessToken}",
        "Content-Type": "application/json",
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});

Example response:

[
    {
        "status": 200,
        "content": "{\n\"code\": 0,\n\"msg\": [],\n\"count\": 0,\n\"data\": {\n  \"user_id\": 1000947,\n  \"name\": \"Tran Vu Hoang\",\n  \"phone\": \"84975711361\",\n  \"email\": \"hoangtv.hn89@gmail.com\",\n  \"type\": 1,\n  \"stat\": 2,\n  \"address\": \"\",\n  \"social_id\": 123213,\n  \"lvl\" : 1,\n  \"token\": \"NmVESFNPcHdKK3JMdEQ5WDZxUmZQb3BNcjJ6N04rZWlXeVNwekViTzF4UWJTNk02VldzRzdBK3BKeU9ZdkFsekh0YXF5d0lCZlZDb3NYaUpoZmJsb3c9PQ==\"\n}\n}"
    }
]

HTTP Request

POST api/v4/linked-wallet/v2/verify-linked

Body Parameters

Parameter Type Status Description
mrc_uuid string required ID User bên phía Merchant
linked_code string required Mã xác nhận liên kết

Gửi yêu cầu huỷ liên kết ví

Headers: Wallet-Token: $wallet_token

Example request:

curl -X POST "https://api.baokim.vn/auth/api/v4/linked-wallet/v2/request-cancel-linked" \
    -H "Authorization: Bearer: {accessToken}" \
    -H "Content-Type: application/json" \
    -d "mrc_uuid"="earum" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/auth/api/v4/linked-wallet/v2/request-cancel-linked",
    "method": "POST",
    "data": {
        "mrc_uuid": "earum"
    },
    "headers": {
        "Authorization": "Bearer: {accessToken}",
        "Content-Type": "application/json",
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});

Example response:

[
    {
        "status": 200,
        "content": "{\n\"code\": 0,\n\"msg\": [],\n\"count\": 0,\n\"data\": {\n\"ticket\": \"NmVESFNPcHdKK3JMdEQ5WDZxUmZQb3BNcjJ6N04rZWlXeVNwekViTzF4UWJTNk02VldzRzdBK3BKeU9ZdkFsekh0YXF5d0lCZlZDb3NYaUpoZmJsb3c9PQ==\"\n}\n}"
    }
]

HTTP Request

POST api/v4/linked-wallet/v2/request-cancel-linked

Body Parameters

Parameter Type Status Description
mrc_uuid string required ID User bên phía Merchant

Xác thực yêu cầu huỷ liên kết ví

Headers: Wallet-Token: $wallet_token

Example request:

curl -X POST "https://api.baokim.vn/auth/api/v4/linked-wallet/v2/verify-cancel-linked" \
    -H "Authorization: Bearer: {accessToken}" \
    -H "Content-Type: application/json" \
    -d "mrc_uuid"="et" \
    -d "otp"="corporis" \
    -d "ticket"="nihil" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/auth/api/v4/linked-wallet/v2/verify-cancel-linked",
    "method": "POST",
    "data": {
        "mrc_uuid": "et",
        "otp": "corporis",
        "ticket": "nihil"
    },
    "headers": {
        "Authorization": "Bearer: {accessToken}",
        "Content-Type": "application/json",
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});

Example response:

[
    {
        "status": 200,
        "content": "{\n\"code\": 0,\n\"msg\": [],\n\"count\": 0,\n\"data\": {\n\"mrc_uuid\": \"5e6cdc5f70892b00010fb0e3\",\n\"bk_uuid\" : 1334065\n}\n}"
    }
]

HTTP Request

POST api/v4/linked-wallet/v2/verify-cancel-linked

Body Parameters

Parameter Type Status Description
mrc_uuid string required ID User bên phía Merchant
otp numeric required OTP
ticket string required Mã ticket nhận ở bước 1

Gửi yêu cầu xác thực tài khoản bằng CMND/CCCD

Headers: Wallet-Token: $wallet_token

Example request:

curl -X POST "https://api.baokim.vn/auth/api/v4/linked-wallet/v2/request-identify-wallet" \
    -H "Authorization: Bearer: {accessToken}" \
    -H "Content-Type: application/json" \
    -d "mrc_uuid"="laboriosam" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/auth/api/v4/linked-wallet/v2/request-identify-wallet",
    "method": "POST",
    "data": {
        "mrc_uuid": "laboriosam"
    },
    "headers": {
        "Authorization": "Bearer: {accessToken}",
        "Content-Type": "application/json",
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});

Example response:

[
    {
        "status": 200,
        "content": "{\n\"code\": 0,\n\"msg\": [],\n\"count\": 0,\n\"data\": {\n\"ticket\": \"NmVESFNPcHdKK3JMdEQ5WDZxUmZQb3BNcjJ6N04rZWlXeVNwekViTzF4UWJTNk02VldzRzdBK3BKeU9ZdkFsekh0YXF5d0lCZlZDb3NYaUpoZmJsb3c9PQ==\"\n}\n}"
    }
]

HTTP Request

POST api/v4/linked-wallet/v2/request-identify-wallet

Body Parameters

Parameter Type Status Description
mrc_uuid string required ID User bên phía Merchant

Xác nhận yêu cầu xác thực tài khoản bằng CMND/CCCD

Headers: Wallet-Token: $wallet_token

Example request:

curl -X POST "https://api.baokim.vn/auth/api/v4/linked-wallet/v2/verify-identify-wallet" \
    -H "Authorization: Bearer: {accessToken}" \
    -H "Content-Type: application/json" \
    -d "mrc_uuid"="ut" \
    -d "ticket"="cum" \
    -d "image-identify-front"="et" \
    -d "image-identify-behind"="animi" \
    -d "profile"="ut" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/auth/api/v4/linked-wallet/v2/verify-identify-wallet",
    "method": "POST",
    "data": {
        "mrc_uuid": "ut",
        "ticket": "cum",
        "image-identify-front": "et",
        "image-identify-behind": "animi",
        "profile": "ut"
    },
    "headers": {
        "Authorization": "Bearer: {accessToken}",
        "Content-Type": "application/json",
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});

Example response:

[
    {
        "status": 200,
        "content": "{\n\"code\": 0,\n\"msg\": [],\n\"count\": 0,\n\"data\": {\n  \"id\": 1000947,\n  \"name\": \"Tran Vu Hoang\",\n  \"phone\": \"84975711361\",\n  \"email\": \"hoangtv.hn89@gmail.com\",\n  \"type\": 1,\n  \"stat\": 2,\n  \"address\": \"\",\n  \"idvg_token\": \"4d4f7b2adf184edc354e2b40faea847d0ff0059b\",\n  \"social_id\": 123213,\n  \"lvl\": 1\n}\n}"
    }
]

HTTP Request

POST api/v4/linked-wallet/v2/verify-identify-wallet

Body Parameters

Parameter Type Status Description
mrc_uuid string required ID User bên phía Merchant
ticket string required Mã ticket nhận ở bước 1
image-identify-front file required Ảnh mặt trước
image-identify-behind file required Ảnh mặt sau
profile file required Ảnh cá nhân chụp với CMND/CCCD

Api check trùng tên thẻ atm và tên ví

Headers: Wallet-Token: $wallet_token

Example request:

curl -X POST "https://api.baokim.vn/auth/api/v4/linked-wallet/v2/check-account-bank" \
    -H "Authorization: Bearer: {accessToken}" \
    -H "Content-Type: application/json" \
    -d "holder"="non" \
    -d "bank_id"="17" \
    -d "bank_account"="voluptates" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/auth/api/v4/linked-wallet/v2/check-account-bank",
    "method": "POST",
    "data": {
        "holder": "non",
        "bank_id": 17,
        "bank_account": "voluptates"
    },
    "headers": {
        "Authorization": "Bearer: {accessToken}",
        "Content-Type": "application/json",
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});

Example response:

[
    {
        "status": 200,
        "content": "{\n\"code\": 0,\n\"message\": [],\n\"count\": 0,\n\"data\": {\n\"is_match\": false\n}\n}"
    }
]

HTTP Request

POST api/v4/linked-wallet/v2/check-account-bank

Body Parameters

Parameter Type Status Description
holder string required Họ tên in trên thẻ
bank_id integer required bank_id từ https://developer.baokim.vn/payment/#bank-api
bank_account string required Số tài khoản atm

Tạo mới mật khẩu giao dịch cho user

khi user chưa có mật khẩu giao dịch Headers: Wallet-Token: $wallet_token

Example request:

curl -X POST "https://api.baokim.vn/auth/api/v4/linked-wallet/v2/create-transaction-password" \
    -H "Authorization: Bearer: {accessToken}" \
    -H "Content-Type: application/json" \
    -d "login_password"="facere" \
    -d "transaction_password"="porro" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/auth/api/v4/linked-wallet/v2/create-transaction-password",
    "method": "POST",
    "data": {
        "login_password": "facere",
        "transaction_password": "porro"
    },
    "headers": {
        "Authorization": "Bearer: {accessToken}",
        "Content-Type": "application/json",
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});

Example response:

[
    {
        "status": 200,
        "content": "{\n\"code\": 0,\n\"msg\": \"thành công\",\n\"count\": 1,\n\"data\": {\n\"id\": 1016334,\n\"user_id\": 1016334,\n\"verify_transaction_by\": \"g2fa\",\n\"transaction_password\": \"$2y$10$EYGvGSr3y6EauC9YehUnuexDVKzeSUb1X56Rj7XjQNjzF7IfiFVtO\",\n\"is_transaction_password_active\": 0,\n\"pin_code\": null,\n\"google2fa_secret\": \"G2D72D46LJHT3QFR\",\n\"is_auto_receiving\": 0,\n\"default_language\": \"vi\",\n\"default_currency\": \"vnd\",\n\"updated_at\": \"2018-11-27 09:55:46\",\n\"created_at\": null\n}\n}"
    }
]

HTTP Request

POST api/v4/linked-wallet/v2/create-transaction-password

Body Parameters

Parameter Type Status Description
login_password string required Mật khẩu đăng nhập
transaction_password string required Mật khẩu giao dịch

Kiểm tra mật khẩu giao dịch cho user

Headers: Wallet-Token: $wallet_token

Example request:

curl -X POST "https://api.baokim.vn/auth/api/v4/linked-wallet/v2/check-transaction-password" \
    -H "Authorization: Bearer: {accessToken}" \
    -H "Content-Type: application/json" \
    -d "transaction_password"="accusantium" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/auth/api/v4/linked-wallet/v2/check-transaction-password",
    "method": "POST",
    "data": {
        "transaction_password": "accusantium"
    },
    "headers": {
        "Authorization": "Bearer: {accessToken}",
        "Content-Type": "application/json",
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});

Example response:

[
    {
        "status": 200,
        "content": "{\n\"code\": 0,\n\"msg\": \"thành công\",\n\"count\": 1,\n\"data\": {\n\"is_match\": true\n}\n}"
    }
]

HTTP Request

POST api/v4/linked-wallet/v2/check-transaction-password

Body Parameters

Parameter Type Status Description
transaction_password string required Mật khẩu giao dịch

Xóa mật khẩu giao dịch cho user

Headers: Wallet-Token: $wallet_token

Example request:

curl -X POST "https://api.baokim.vn/auth/api/v4/linked-wallet/v2/delete-transaction-password" \
    -H "Authorization: Bearer: {accessToken}" \
    -H "Content-Type: application/json" \
    -d "password"="expedita" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/auth/api/v4/linked-wallet/v2/delete-transaction-password",
    "method": "POST",
    "data": {
        "password": "expedita"
    },
    "headers": {
        "Authorization": "Bearer: {accessToken}",
        "Content-Type": "application/json",
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});

Example response:

[
    {
        "status": 200,
        "content": "{\n\"code\": 0,\n\"msg\": \"thành công\",\n\"count\": 1,\n\"data\": {\n\"is_delete\": true\n}\n}"
    }
]

HTTP Request

POST api/v4/linked-wallet/v2/delete-transaction-password

Body Parameters

Parameter Type Status Description
password string required Mật khẩu đăng nhập

User APIs

Lấy thông tin user bằng Facebook/Google access_token

Example request:

curl -X POST "https://api.baokim.vn/auth/api/v4/user/get-user-by-social-token" \
    -H "Authorization: Bearer: {accessToken}" \
    -H "Content-Type: application/json" \
    -d "token"="excepturi" \
    -d "provider"="provident" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/auth/api/v4/user/get-user-by-social-token",
    "method": "POST",
    "data": {
        "token": "excepturi",
        "provider": "provident"
    },
    "headers": {
        "Authorization": "Bearer: {accessToken}",
        "Content-Type": "application/json",
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});

Example response:

[
    {
        "status": 200,
        "content": "{\n\"code\": 0,\n\"msg\": \"\",\n\"count\": 0,\n\"data\": {\n\"id\": 1000947,\n\"name\": \"Nguyen Van A\",\n\"phone\": \"84910586741\",\n\"email\": \"nguyenvana@gmail.com\",\n\"type\": 1,\n\"stat\": 2,\n\"address\": \"\",\n\"idvg_token\": \"4d4f7b2adf184edc354e2b40faea847d0ff0059b\",\n\"social_id\": 123213,\n\"lvl\": 1,\n\"google_id\": \"12345678987654321\",\n\"facebook_id\": \"12345678987654321\",\n\"access_token\": \"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjQ4NjdmMzlkMWQzNTA5ZmE5MmI0NDE2ODM0Y2EzZWE3NWQzZTg3MjRjZTQ2YzgzMDczZDc5ZWIyNTI2YjZmNzcwMjgxZmUxODY4YWNiNjMzIn0.eyJhdWQiOiI4IiwianRpIjoiNDg2N2YzOWQxZDM1MDlmYTkyYjQ0MTY4MzRjYTNlYTc1ZDNlODcyNGNlNDZjODMwNzNkNzllYjI1MjZiNmY3NzAyODFmZTE4NjhhY2I2MzMiLCJpYXQiOjE1NTgwNjU5NjIsIm5iZiI6MTU1ODA2NTk2MiwiZXhwIjoxNTg5Njg4MzYyLCJzdWIiOiIxMzMwNTc3Iiwic2NvcGVzIjpbXX0.Of1bnojqHYFZh_yCOm_ZEGeREhCSKv11SmDRkPA83sw16X9M1_Fbh6AxsexBcn8-crDF80Xihsq7BrYVJoz4nv0zOq8cB9wsr0vh1-toeHt2PwinaNRmCSPMk0rkztZ83SQQmJ2KGzIIR3YM47wdFq-UDIRo-Kg3HWu5zv-d7-m8WsaEztDAtfK3Z6syViVgfTbaD0gyGivW136wCWfkgQ-LNzgfl2OoDEeYi5Xoeiq7v5U8ufic7mLF2X9oww9EekyEv28GTpksRnp9VqojeRa_RlAFLlGt1k6On9WohLAqgH6fZHuJOGdNqCf94UHwlWrpdzOdzM90mpLKTrf93-CGQ0cabjj__ygucr1wrvDJMHBvUDPCLVQXEulLzZg1TT7CGncOBF7yQZ8WYlqvyHWa8picmM7pfMdpwEkTooTY7AFR0rzLVBO2_Im7GSBk77tUoeCWpiPaCgv-HsxcEJlXKKKwKwlwn7WWZa9-kFGxnSTl4LsHtd82zTgvE6xhivhi0iv8eUHyXh9EH_RBZIH1dANysKyM9nYmk_E0hiYneJkQfKa33zLiYjs6mk116eQtBor7liNk1VKSWxYoP_MoV6ZYMILP8oinEwDyIoTOfLxC95PZw88bUAEBx63oNLkNhFSBNTYq21FkBRBhLSueLWH60klONXnhBQsrYZQ\",\n\"ticket\": \"0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjQ4NjdmMzlkMWQzNTA5ZmE5MmI0NDE2ODM0Y2EzZWE3NWQzZTg3MjRjZTQ2YzgzMDczZDc5ZWIyNTI2YjZmNzcwMjgxZmUxODY4YWNiNjMzIn0.eyJhdWQiOiI4IiwianRpIjoiNDg2N2YzOWQxZDM1MDlmYTkyYjQ0MTY4MzRjYTNlYTc1ZDNlODcyNGNlNDZjODMwNzNkNzllYjI1MjZiNmY3NzAyODFmZTE4Nj\"\n}\n}"
    }
]

HTTP Request

POST api/v4/user/get-user-by-social-token

Body Parameters

Parameter Type Status Description
token string required Token của FB hoặc GG
provider string required facebook, google

Đăng ký Tài khoản

Example request:

curl -X POST "https://api.baokim.vn/auth/api/v4/user/register-v2" \
    -H "Authorization: Bearer: {accessToken}" \
    -H "Content-Type: application/json" \
    -d "email"="totam" \
    -d "name"="aperiam" \
    -d "password"="quasi" \
    -d "phone"="nostrum" \
    -d "city_id"="impedit" \
    -d "district_id"="15" \
    -d "address"="dolores" \
    -d "type"="19" \
    -d "business_number"="nesciunt" \
    -d "business_name"="quod" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/auth/api/v4/user/register-v2",
    "method": "POST",
    "data": {
        "email": "totam",
        "name": "aperiam",
        "password": "quasi",
        "phone": "nostrum",
        "city_id": "impedit",
        "district_id": 15,
        "address": "dolores",
        "type": 19,
        "business_number": "nesciunt",
        "business_name": "quod"
    },
    "headers": {
        "Authorization": "Bearer: {accessToken}",
        "Content-Type": "application/json",
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});

Example response:

[
    {
        "status": 200,
        "content": "{\n\"code\": 0,\n\"msg\": \"\",\n\"count\": 0,\n\"data\": {\n\"id\": 1000947,\n\"name\": \"Tran Vu Hoang\",\n\"phone\": \"84975711361\",\n\"email\": \"hoangtv.hn89@gmail.com\",\n\"type\": 1,\n\"stat\": 2,\n\"address\": \"\",\n\"social_id\": 123213,\n\"lvl\": 1\n}\n}"
    }
]

HTTP Request

POST api/v4/user/register-v2

Body Parameters

Parameter Type Status Description
email string required Email
name string required Họ và tên
password string required Mật khẩu
phone string required Số điện thoại
city_id string optional ID tỉnh/thành phố (Format: ha_noi, da_nang)
district_id integer optional ID quận/huyện
address string optional Địa chỉ
type integer optional Loại tài khoản (1: cá nhân, 2: doanh nghiệp)
business_number string optional Số đăng ký kinh doanh/Mã số thuế
business_name string optional Tên doanh nghiệp

Get user

[Sử dụng access_token gửi trên header : Authorization : Bearer access_token]

Example request:

curl -X GET -G "https://api.baokim.vn/auth/api/v4/user/detail" \
    -H "Authorization: Bearer: {accessToken}"
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/auth/api/v4/user/detail",
    "method": "GET",
    "headers": {
        "Authorization": "Bearer: {accessToken}",
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});

Example response:

[
    {
        "status": 200,
        "content": "{\n\"code\": 1,\n\"msg\": \"thành công\",\n\"count\": 1,\n\"data\": {\n\"id\": 1000947,\n\"vg_id\": 1000000,\n\"name\": \"Tran Vu Hoang\",\n\"phone\": \"84975711361\",\n\"email\": \"hoangtv.hn89@gmail.com\",\n\"type\": 1,\n\"stat\": 2,\n\"address\": \"\",\n\"idvg_token\": \"4d4f7b2adf184edc354e2b40faea847d0ff0059b\",\n\"social_id\": 123213,\n\"city_id\": 123213,\n\"district_id\": 123213,\n\"bod\": 123213,\n\"lvl\": 1,\n\"gender\": \"MALE\",\n\"is_email_verified\" : 0,\n\"is_phone_verified\" : 0,\n\"parent_id\": 10000\n\"permissions\": []\n}\n}"
    },
    {
        "status": 500,
        "content": "{\n    \"message\": \"file_put_contents(\/var\/www\/baokim\/auth.ws\/storage\/framework\/cache\/data\/44\/d1\/44d142505dd1a3b497197e2f459d2aec779e9ed6): failed to open stream: No such file or directory\",\n    \"exception\": \"ErrorException\",\n    \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Filesystem\/Filesystem.php\",\n    \"line\": 122,\n    \"trace\": [\n        {\n            \"function\": \"handleError\",\n            \"class\": \"Illuminate\\\\Foundation\\\\Bootstrap\\\\HandleExceptions\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Filesystem\/Filesystem.php\",\n            \"line\": 122,\n            \"function\": \"file_put_contents\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Cache\/FileStore.php\",\n            \"line\": 65,\n            \"function\": \"put\",\n            \"class\": \"Illuminate\\\\Filesystem\\\\Filesystem\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Cache\/Repository.php\",\n            \"line\": 208,\n            \"function\": \"put\",\n            \"class\": \"Illuminate\\\\Cache\\\\FileStore\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Cache\/Repository.php\",\n            \"line\": 275,\n            \"function\": \"put\",\n            \"class\": \"Illuminate\\\\Cache\\\\Repository\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Cache\/RateLimiter.php\",\n            \"line\": 60,\n            \"function\": \"add\",\n            \"class\": \"Illuminate\\\\Cache\\\\Repository\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Routing\/Middleware\/ThrottleRequests.php\",\n            \"line\": 56,\n            \"function\": \"hit\",\n            \"class\": \"Illuminate\\\\Cache\\\\RateLimiter\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Pipeline\/Pipeline.php\",\n            \"line\": 163,\n            \"function\": \"handle\",\n            \"class\": \"Illuminate\\\\Routing\\\\Middleware\\\\ThrottleRequests\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Routing\/Pipeline.php\",\n            \"line\": 53,\n            \"function\": \"Illuminate\\\\Pipeline\\\\{closure}\",\n            \"class\": \"Illuminate\\\\Pipeline\\\\Pipeline\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Pipeline\/Pipeline.php\",\n            \"line\": 104,\n            \"function\": \"Illuminate\\\\Routing\\\\{closure}\",\n            \"class\": \"Illuminate\\\\Routing\\\\Pipeline\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Routing\/Router.php\",\n            \"line\": 684,\n            \"function\": \"then\",\n            \"class\": \"Illuminate\\\\Pipeline\\\\Pipeline\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Routing\/Router.php\",\n            \"line\": 659,\n            \"function\": \"runRouteWithinStack\",\n            \"class\": \"Illuminate\\\\Routing\\\\Router\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Routing\/Router.php\",\n            \"line\": 625,\n            \"function\": \"runRoute\",\n            \"class\": \"Illuminate\\\\Routing\\\\Router\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Routing\/Router.php\",\n            \"line\": 614,\n            \"function\": \"dispatchToRoute\",\n            \"class\": \"Illuminate\\\\Routing\\\\Router\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Foundation\/Http\/Kernel.php\",\n            \"line\": 176,\n            \"function\": \"dispatch\",\n            \"class\": \"Illuminate\\\\Routing\\\\Router\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Routing\/Pipeline.php\",\n            \"line\": 30,\n            \"function\": \"Illuminate\\\\Foundation\\\\Http\\\\{closure}\",\n            \"class\": \"Illuminate\\\\Foundation\\\\Http\\\\Kernel\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/fideloper\/proxy\/src\/TrustProxies.php\",\n            \"line\": 57,\n            \"function\": \"Illuminate\\\\Routing\\\\{closure}\",\n            \"class\": \"Illuminate\\\\Routing\\\\Pipeline\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Pipeline\/Pipeline.php\",\n            \"line\": 163,\n            \"function\": \"handle\",\n            \"class\": \"Fideloper\\\\Proxy\\\\TrustProxies\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Routing\/Pipeline.php\",\n            \"line\": 53,\n            \"function\": \"Illuminate\\\\Pipeline\\\\{closure}\",\n            \"class\": \"Illuminate\\\\Pipeline\\\\Pipeline\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Foundation\/Http\/Middleware\/TransformsRequest.php\",\n            \"line\": 31,\n            \"function\": \"Illuminate\\\\Routing\\\\{closure}\",\n            \"class\": \"Illuminate\\\\Routing\\\\Pipeline\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Pipeline\/Pipeline.php\",\n            \"line\": 163,\n            \"function\": \"handle\",\n            \"class\": \"Illuminate\\\\Foundation\\\\Http\\\\Middleware\\\\TransformsRequest\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Routing\/Pipeline.php\",\n            \"line\": 53,\n            \"function\": \"Illuminate\\\\Pipeline\\\\{closure}\",\n            \"class\": \"Illuminate\\\\Pipeline\\\\Pipeline\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Foundation\/Http\/Middleware\/TransformsRequest.php\",\n            \"line\": 31,\n            \"function\": \"Illuminate\\\\Routing\\\\{closure}\",\n            \"class\": \"Illuminate\\\\Routing\\\\Pipeline\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Pipeline\/Pipeline.php\",\n            \"line\": 163,\n            \"function\": \"handle\",\n            \"class\": \"Illuminate\\\\Foundation\\\\Http\\\\Middleware\\\\TransformsRequest\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Routing\/Pipeline.php\",\n            \"line\": 53,\n            \"function\": \"Illuminate\\\\Pipeline\\\\{closure}\",\n            \"class\": \"Illuminate\\\\Pipeline\\\\Pipeline\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Foundation\/Http\/Middleware\/ValidatePostSize.php\",\n            \"line\": 27,\n            \"function\": \"Illuminate\\\\Routing\\\\{closure}\",\n            \"class\": \"Illuminate\\\\Routing\\\\Pipeline\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Pipeline\/Pipeline.php\",\n            \"line\": 163,\n            \"function\": \"handle\",\n            \"class\": \"Illuminate\\\\Foundation\\\\Http\\\\Middleware\\\\ValidatePostSize\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Routing\/Pipeline.php\",\n            \"line\": 53,\n            \"function\": \"Illuminate\\\\Pipeline\\\\{closure}\",\n            \"class\": \"Illuminate\\\\Pipeline\\\\Pipeline\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Foundation\/Http\/Middleware\/CheckForMaintenanceMode.php\",\n            \"line\": 62,\n            \"function\": \"Illuminate\\\\Routing\\\\{closure}\",\n            \"class\": \"Illuminate\\\\Routing\\\\Pipeline\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Pipeline\/Pipeline.php\",\n            \"line\": 163,\n            \"function\": \"handle\",\n            \"class\": \"Illuminate\\\\Foundation\\\\Http\\\\Middleware\\\\CheckForMaintenanceMode\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Routing\/Pipeline.php\",\n            \"line\": 53,\n            \"function\": \"Illuminate\\\\Pipeline\\\\{closure}\",\n            \"class\": \"Illuminate\\\\Pipeline\\\\Pipeline\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Pipeline\/Pipeline.php\",\n            \"line\": 104,\n            \"function\": \"Illuminate\\\\Routing\\\\{closure}\",\n            \"class\": \"Illuminate\\\\Routing\\\\Pipeline\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Foundation\/Http\/Kernel.php\",\n            \"line\": 151,\n            \"function\": \"then\",\n            \"class\": \"Illuminate\\\\Pipeline\\\\Pipeline\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Foundation\/Http\/Kernel.php\",\n            \"line\": 116,\n            \"function\": \"sendRequestThroughRouter\",\n            \"class\": \"Illuminate\\\\Foundation\\\\Http\\\\Kernel\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/mpociot\/laravel-apidoc-generator\/src\/Strategies\/Responses\/ResponseCalls.php\",\n            \"line\": 292,\n            \"function\": \"handle\",\n            \"class\": \"Illuminate\\\\Foundation\\\\Http\\\\Kernel\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/mpociot\/laravel-apidoc-generator\/src\/Strategies\/Responses\/ResponseCalls.php\",\n            \"line\": 274,\n            \"function\": \"callLaravelRoute\",\n            \"class\": \"Mpociot\\\\ApiDoc\\\\Strategies\\\\Responses\\\\ResponseCalls\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/mpociot\/laravel-apidoc-generator\/src\/Strategies\/Responses\/ResponseCalls.php\",\n            \"line\": 46,\n            \"function\": \"makeApiCall\",\n            \"class\": \"Mpociot\\\\ApiDoc\\\\Strategies\\\\Responses\\\\ResponseCalls\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/mpociot\/laravel-apidoc-generator\/src\/Tools\/Generator.php\",\n            \"line\": 147,\n            \"function\": \"__invoke\",\n            \"class\": \"Mpociot\\\\ApiDoc\\\\Strategies\\\\Responses\\\\ResponseCalls\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/mpociot\/laravel-apidoc-generator\/src\/Tools\/Generator.php\",\n            \"line\": 108,\n            \"function\": \"iterateThroughStrategies\",\n            \"class\": \"Mpociot\\\\ApiDoc\\\\Tools\\\\Generator\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/mpociot\/laravel-apidoc-generator\/src\/Tools\/Generator.php\",\n            \"line\": 72,\n            \"function\": \"fetchResponses\",\n            \"class\": \"Mpociot\\\\ApiDoc\\\\Tools\\\\Generator\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/mpociot\/laravel-apidoc-generator\/src\/Commands\/GenerateDocumentation.php\",\n            \"line\": 233,\n            \"function\": \"processRoute\",\n            \"class\": \"Mpociot\\\\ApiDoc\\\\Tools\\\\Generator\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/mpociot\/laravel-apidoc-generator\/src\/Commands\/GenerateDocumentation.php\",\n            \"line\": 84,\n            \"function\": \"processRoutes\",\n            \"class\": \"Mpociot\\\\ApiDoc\\\\Commands\\\\GenerateDocumentation\",\n            \"type\": \"->\"\n        },\n        {\n            \"function\": \"handle\",\n            \"class\": \"Mpociot\\\\ApiDoc\\\\Commands\\\\GenerateDocumentation\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Container\/BoundMethod.php\",\n            \"line\": 29,\n            \"function\": \"call_user_func_array\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Container\/BoundMethod.php\",\n            \"line\": 87,\n            \"function\": \"Illuminate\\\\Container\\\\{closure}\",\n            \"class\": \"Illuminate\\\\Container\\\\BoundMethod\",\n            \"type\": \"::\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Container\/BoundMethod.php\",\n            \"line\": 31,\n            \"function\": \"callBoundMethod\",\n            \"class\": \"Illuminate\\\\Container\\\\BoundMethod\",\n            \"type\": \"::\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Container\/Container.php\",\n            \"line\": 572,\n            \"function\": \"call\",\n            \"class\": \"Illuminate\\\\Container\\\\BoundMethod\",\n            \"type\": \"::\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Console\/Command.php\",\n            \"line\": 183,\n            \"function\": \"call\",\n            \"class\": \"Illuminate\\\\Container\\\\Container\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/symfony\/console\/Command\/Command.php\",\n            \"line\": 255,\n            \"function\": \"execute\",\n            \"class\": \"Illuminate\\\\Console\\\\Command\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Console\/Command.php\",\n            \"line\": 170,\n            \"function\": \"run\",\n            \"class\": \"Symfony\\\\Component\\\\Console\\\\Command\\\\Command\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/symfony\/console\/Application.php\",\n            \"line\": 915,\n            \"function\": \"run\",\n            \"class\": \"Illuminate\\\\Console\\\\Command\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/symfony\/console\/Application.php\",\n            \"line\": 272,\n            \"function\": \"doRunCommand\",\n            \"class\": \"Symfony\\\\Component\\\\Console\\\\Application\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/symfony\/console\/Application.php\",\n            \"line\": 148,\n            \"function\": \"doRun\",\n            \"class\": \"Symfony\\\\Component\\\\Console\\\\Application\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Console\/Application.php\",\n            \"line\": 89,\n            \"function\": \"run\",\n            \"class\": \"Symfony\\\\Component\\\\Console\\\\Application\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/vendor\/laravel\/framework\/src\/Illuminate\/Foundation\/Console\/Kernel.php\",\n            \"line\": 122,\n            \"function\": \"run\",\n            \"class\": \"Illuminate\\\\Console\\\\Application\",\n            \"type\": \"->\"\n        },\n        {\n            \"file\": \"\/var\/www\/baokim\/auth.ws\/artisan\",\n            \"line\": 37,\n            \"function\": \"handle\",\n            \"class\": \"Illuminate\\\\Foundation\\\\Console\\\\Kernel\",\n            \"type\": \"->\"\n        }\n    ]\n}"
    }
]

HTTP Request

GET api/v4/user/detail

Nâng cấp tài khoản cá nhân lên tài khoản doanh nghiệp

Example request:

curl -X POST "https://api.baokim.vn/auth/api/v4/linked-wallet/v2/upgrade-to-business" \
    -H "Authorization: Bearer: {accessToken}" \
    -H "Content-Type: application/json" \
    -d "business_number"="quod" \
    -d "site_url"="at" \
    -d "name"="reiciendis" \
    -d "business_area_id"="6" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/auth/api/v4/linked-wallet/v2/upgrade-to-business",
    "method": "POST",
    "data": {
        "business_number": "quod",
        "site_url": "at",
        "name": "reiciendis",
        "business_area_id": 6
    },
    "headers": {
        "Authorization": "Bearer: {accessToken}",
        "Content-Type": "application/json",
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});

Example response:

[
    {
        "status": 200,
        "content": "{\n\"code\": 0,\n\"message\": [],\n\"count\": 0,\n\"data\": {\n\"user_id\": 1330819,\n\"email\": \"haumv174@gmail.com\",\n\"name\": \"Công ty Bảo Kim\",\n\"business_number\": \"1234566789\",\n\"business_area_id\": \"1\",\n\"phone\": \"84396461662\",\n\"site_url\": null,\n\"updated_at\": \"2019-12-25 10:53:15\",\n\"created_at\": \"2019-12-25 10:53:15\",\n\"id\": 1016100\n}\n}"
    }
]

HTTP Request

POST api/v4/linked-wallet/v2/upgrade-to-business

Body Parameters

Parameter Type Status Description
business_number string required Số kinh doanh
site_url string required Website doanh nghiệp
name string required Tên doanh nghiệp
business_area_id integer optional Lĩnh vực kinh doanh