Run
privo.ageGate.run(data)
interface CheckAgeData {
userIdentifier?: string;
birthDateYYYYMMDD?: string;
birthDateYYYYMM?: string;
birthDateYYYY?: string;
countryCode?: string;
}
The method runs the Age Gate check: if the birth date is passed or filled in by a user, the method will return the
status "Undefined", "Blocked", "Allowed" "Сanceled", "Pending", "ConsentRequired", "ConsentApproved", "ConsentDenied, "
AgeVerificationRequired", "AgeVerified", "AgeBlocked", "IdentityVerificationRequired", "IdentityVerified", depending on
the user’s age and set by a partner configuration parameters.
If the birth date is not passed, a user will be navigated to a corresponding entry window and forced to fill in the
birthday field. The new entry window has two display modes: Redirect and Popup.
Redirect mode implies sending users to a different URL from the one they originally requested. Popup mode implies
displaying via a popup browser window that is displayed on top of the existing windows on the screen.
CheckAgeData entry parameters:
userIdentifier - optional field, external user identifier
birthDateYYYYMMDD - optional field, external user birth date in "yyyy-MM-dd" format
birthDateYYYYMM - optional field, external user birth date in "yyyy-MM" format
birthDateYYYY - optional field, external user birth date in "yyyy" format
countryCode - optional field, two-letter country code (ISO 3166-1
alpha-2 Wiki).
Note: if a user passes data in an age format, there is a need to convert this data into YYYY format and pass the birth date via the birthDateYYYY entry parameter. For example, if the age data received from a user is 16, a partner is responsibe to convert this data into the birth year (current year - 16 = birth year) and pass this value via the birthDateYYYY entry parameter.
Result of invocation privo.ageGate.run(data) will be provided in onStatusChange callback function.
privo.ageGate.onStatusChange(event => {}) should be set before privo.ageGate.run is invoked.
Please check the Age Gate Status Description here
JS (Typescript) Age Gate SDK example:
{
"id":"861dc238-...-c1dfe",
"status":"Allowed",
"extUserId":"9ede0f0-...a78", //optional
"countryCode":"US" //optional
}
Sample Webhook Response:
ageGate.init({
serviceIdentifier,
displayMode: "redirect",
});
ageGate.onStatusChange((event) => {
setEvents((prev) => [...prev, event.status]);
});
// ...
ageGate.getStatus(state.userIdentifier).then((event) => {
setEvents((prev) => [...prev, event.status]);
});
// ...
ageGate.run({
userIdentifier,
countryCode,
birthDateYYYYMMDD,
});
// ...
ageGate.recheck({
userIdentifier,
countryCode,
});