This document describes how to build a custom registration page for the affiliates using TAP API.
Affiliate registration API
An Operator can implement their own affiliate registration page that is using TAP API.
The API is using simple HTTP-POST to the URL
POST body is JSON in format
{
"hostname": "aff-home.smartico.ai”, // the domain host from which the affiliate will register
"first_name": "First-name",
"last_name": "Last-name",
"bo_user_email": "somemail@somewhere",
"phone_number": "44097657269",
"username": "username123",
"password": "Q!w2e3r4",
"skype": "skype",
"company": "Astelit",
"web_site_url": "https://googe.com",
"country": "BG",
"comments": "some info",
"language": "FR",
"tc": true,
"token": "03AGdBq261a4cR1-w32PCilF0nq04_cjKIl8T6OeWlAnC4fWfYu94Mw6VIEdazhgDwcf_UkN1pBmTSixVNKKVXXyi-4f3f77VKQkgGKdCUs-dREm_YmwtMfYkgHj00YsQz0T3S3fHRP-XYgJkk0M7bUcaB3Lf6DA7gmZtQynXssdX3a5ElmyEJf5NTTX5IfmS3oiIL0OWWCxFiDfyPdTOoZJAjL9fMcFoqCD2_cJDiqZMNjLCIaUDQX1LgAaEr96FJ3dJ1vUwB3RnU3O-mefSffMvQtkQa-19CK78mpmQ6gDDCXD9zmdumH_aowNGyqN2BTgkrM0vwk4tmKRn6vDY5ue58jZItI7660oI3YfA96N43U_scBSBOC12qmpzNMf_T7esq3kJJTgH_rw8uQSzZk3bncCE2bPjeFg"
}
Notes regarding parameters:
Password should be at least 6 characters, have one lowercase letter, one uppercase letter, and one number
The following fields are mandatory: 'first_name', 'last_name', 'username', 'password', 'bo_user_email', 'country', 'tc', 'hostname', 'token'
Hostname should match exactly to the hostname that is configured in TAP BackOffice for the operator. Only one hostname is allowed.
username should be 6 characters minimum
The system is not allowing duplicate usernames and mails
Language parameter should be ISO 2 symbols code of language
You can also pass optional parameters
// new affiliate will be assigned as a child of specified parent_affilaite_id
parent_affiliate_id: number;
// affiliate will be assigned to a specific manager
// and automatically approved (otherwise he is in a pending state)
manager_id: number;
// FaceBook page for contact
contact_fb: string;
// VK page for contact
contact_vk: string;
// Telegram page for contact
contact_telegram: string;
// Additional permissions for the affiliate.
// Check "More API Methods" page for possible Role IDs
extra_role_ids: number[];
// ID of the Affiliate in the external system
ext_affiliate_id: string;
// Payment method and respective payment method details of the affilaites
// Check "More API Methods" page for possible payment methods
payment_method_id: number;
payment_method_details: {
[key: string]: any
}
The API can return the following error codes
enum AffApiErrors {
OK = 0,
BOT = -1,
FORM_NOT_VALID = -2,
USERNAME_RULE_NOT_VALUD = -3, // Username should be at least 6 symbols
CANNOT_FIND_AFFILIATE_OPERATOR_BY_HOST = -5, // the ‘hostname’ as parameter is identifying an ‘operator’. System can support multiple operators. See explanation below
FAIL_IN_REGISTRATION_FLOW = -6,
USERNAME_ALREADY_EXISTS = -7,
EMAIL_ALREADY_EXISTS = -8,
PASSWORD_STRENGTH = -9, // Password should be at least 6 symbols, have one lowercase later, one uppercase later and one number
}
Setting up Google ReCaptcha on the front end.
Add the following script on your front-end
<script src="https://www.google.com/recaptcha/api.js?render=6LeR49UfAAAAAO7J7vKDCD4vM-Lq5ZA_NsquS9J_"></script>
// Obtain the token in the following way
<script>
var _reCAPTCHA_site_key_ = '6LeR49UfAAAAAO7J7vKDCD4vM-Lq5ZA_NsquS9J_';
grecaptcha.execute(_reCAPTCHA_site_key_, {action: 'affregistration'}).then(function(token) {
// pass token to the API call to Affiliate registration API
});
</script>
It's also possible to make API calls from the server side (backend) without using re-captcha protection. Please contact your Account Manager in this case to disable re-captcha verification for your setup