15. Pre-Registered Account Setup
Some shops may have already registered to use GHTK services. In these cases, it is not necessary to create a new account. Instead, simply retrieve the token of the shop account using this API
Hyperlink
POST /services/shops/token
- HTTP
- CURL
- PHP
POST https://services.giaohangtietkiem.vn/services/shops/token HTTP/1.1
Host: services.giaohangtietkiem.vn
Token: APITokenSample-ca441e70288cB0515F310742
Content-Type: application/json
{
"email": "shoptest@email.com",
"password": "1S@fF#K2"
}
curl -X POST -H "Token: APITokenSample-ca441e70288cB0515F310742" \
-H "Content-Type: application/json;" \
-d '{"email": "shoptest@email.com", "password": "1S@fF#K2"}' \
"https://services.giaohangtietkiem.vn/services/shops/token"
<?php
$order = ;
{
"email": "shoptest@email.com",
"password": "1S@fF#K2"
};
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => " https://services.giaohangtietkiem.vn/services/shops/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $order,
CURLOPT_HTTPHEADER => array(
"Content-Type: application/json",
"Content-Length: " . strlen($order),
"Token: APITokenSample-ca441e70288cB0515F310742",
),
));
$response = curl_exec($curl);
curl_close($curl);
echo 'Response: ' . $response;
?>
Parameters
Parameter | Required | Description |
---|---|---|
yes | Email of the account to retrieve the token for | |
password | yes | Password of the account to authenticate login |
Notes
info
Note: Only B2C accounts are allowed to use this API to retrieve tokens.
Response
Success
{
"success": true,
"message": "Thành công",
"data": {
"code": "S19159",
"token": "5568B780966147C0764EDD207af0233516E4c683"
}
}
When the authentication credentials (email or password) are incorrect
{
"success": false,
"message": "Dữ liệu đăng nhập không hợp lệ"
}
When the B2C account does not have permission to retrieve the token of the requested account
{
"success": false,
"message": "Tài khoản của bạn không có quyền sử dụng API này"
}