Client Registration
Checking Client Data
Before creating a new client record, it is necessary to check whether a client with the provided identifiers already exists.
To perform the check, use the method for retrieving client information.
Client identifiers (phone, email, origin_user_id) are passed in the request.
Identifiers must be checked one by one, with one identifier per request.
If a client provided both a phone number and an email during registration, the application must perform two separate requests:
- the first one with the phone number;
- the second one with the email.
If multiple identifiers are passed in a single request, the server will return an error:
{
"status": "error",
"status_code": -1,
"message": "Provide origin_user_id or user_phone not both"
}
If a record with the provided identifier is not found, the server will return:
{
"status": "error",
"status_code": -4000,
"message": "User not found"
}
Existing Client Found
In case of success, the method will return an object with the client's data:
{
"status": "ok",
"last_name": "Ivanov",
"first_name": "Ivan",
"middle_name": "Ivanovich",
"sex": 1,
"phone": "734853058432",
"email": "ivanovii@gmail.com",
"birth_date": "1981-12-31",
"id": 123456,
"origin_user_id": "53480256",
"referral_promocode": "Q3957YE",
"avatar": null
}
In this case, it is recommended to:
- display a message to the user that the client is already registered;
- or update the found client's data using the client update method.
Merging Client Records
When checking multiple identifiers for a single client, a situation may occur where different client records are found for different identifiers (for example, one record by phone, another by email).
For such cases, a client record merging mechanism is provided.
During merging:
- bonus points;
- tags;
- purchase history;
- other related data
will be combined into a single client card.
Registration Confirmation via SMS
When registering a client by phone number and discovering a record with the same number, an SMS registration confirmation mechanism is available.
A method for sending an SMS with a 4-digit confirmation code is used.
The application interface should provide:
- a field for entering the confirmation code:
- by an employee (offline scenarios, checkout);
- or by the client themselves (website / mobile app).
After entering the code, it must be matched with the code received in the API response.
Adding a New Client
If the check of client data was successful and no existing records were found, the application must create a new client record.
The registration of a new client is performed by sending a request to the client creation method.
The request must contain:
- application authorization data;
- at least one client identifier:
user_phone;email;origin_user_id.