14. Create Account
Hyperlink
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;
?>
Parameters
Parameter | Required | Description |
---|---|---|
name | yes | Display name of the account |
first_address | yes | Detailed address (e.g., house number, alley, street, ward/commune, etc.) |
province | yes | Province/City name – e.g., Hà Nội, Thái Bình |
district | yes | District or city under the province – e.g., Cầu Giấy, Tp. Thái Bình |
tel | yes | Phone number for contact |
yes | Email address of the account |
Note
info
Note: Accounts created via the API can log in using the email and create orders on the GHTK system just like any regular account.
info
Note: If the B2C shop's customer already has an account on the GHTK system, you can retrieve the token from the "Edit Shop Information" section. It is not mandatory to create a new account via API.
Response
When an account is successfully created:
Parameter | Required | Description |
---|---|---|
data.code | yes | GHTK’s account code |
data.token | yes | Account’s token |
{
"success": true,
"message": "Thành công",
"data": {
"code": "S55163",
"token": "93A7392A44c99e7Ca395eef1321D03731B844111"
}
}
When the provided email or phone number is already in use for another account
{
"success": false,
"message": "Email shop này đã tồn tại",
"data": null
}
When the B2C account does not have permission to create new accounts
{
"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
}