13. Tạo tài khoản
Create Account
Path
POST /services/shops/add
- HTTP
- CURL
- PHP
POST https://services.giaohangtietkiem.vn/services/shops/add HTTP/1.1
Token: APITokenSample-ca441e70288cB0515F310742
Host: services.giaohangtietkiem.vn
Content-length: 351
Content-Type: application/x-www-form-urlencoded
name=shop+test&first_address=ng%C3%B5+2%2C+Phan+B%C3%A1+V%C3%A0nh%2C+C%E1%BA%A7u+Di%E1%BB%85n&province=H%C3%A0+N%E1%BB%99i&district=B%E1%BA%AFc+T%E1%BB%AB+Li%C3%AAm&tel=01234555666&email=shoptest%40email.com
curl -X POST -H "Token: APITokenSample-ca441e70288cB0515F310742" \
-H "Content-Type: application/json;" \
-d '{"name":"shop test","first_address":"ngõ 2, Phan Bá Vành, Cầu Diễn","province":"Hà Nội","district":"Bắc Từ Liêm","tel":"01234555666","email":"shoptest@email.com"}' \
"https://services.giaohangtietkiem.vn/services/shops/add"
<?php
$order = '
{
"name": "shop test",
"first_address": "ngõ 2, Phan Bá Vành, Cầu Diễn",
"province": "Hà Nội",
"district": "Bắc Từ Liêm",
"tel": "01234555666",
"email": "shoptest@email.com"
}';
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://services.giaohangtietkiem.vn/services/shops/add",
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;
?>
Parameter Description
Params | Required | Description |
---|---|---|
name | yes | Display name of the account |
first_address | yes | Detailed address of the account (house number, alley, street, ward, etc.) |
province | yes | Name of province/city, e.g., Hanoi, Thai Binh. |
district | yes | Name of district e.g., Cau Giay, Thai Binh City. |
tel | yes | Contact phone number of the account. |
yes | Email of the account. |
Note
info
Note: Accounts created via the API can log in using their email and place orders on the GHTK system like any other regular accounts.
info
Note: If the customer of the B2C shop already has an account on GHTK, the token information can be retrieved from the "Edit Shop Information" section. There is no need to create a new account via the API.
Response
Response when account creation is successful:
Params | Required | Description |
---|---|---|
data.code | yes | Account code on the GHTK system. |
data.token | yes | Token of the account. |
{
"success": true,
"message": "Thành công",
"data": {
"code": "S55163",
"token": "93A7392A44c99e7Ca395eef1321D03731B844111"
}
}
In the case that the email or phone number has already been used for another account.
{
"success": false,
"message": "Email shop này đã tồn tại",
"data": null
}
In the case that the B2C account does not have permission to create a new account.
{
"success": false,
"message": "Tài khoản của bạn không có quyền tạo tài khoản mới trên GHTK",
"data": null
}