Age Gate Module
First you need to import and instantiate PRIVO auth module:
import com.privo.sdk.PrivoAgeGate
You can instantiate the PRIVO auth module with Context:
val ageGate = PrivoAgeGate(this)
Method 1: Check Status
ageGate.getStatus(userIdentifier)
The method allows checking the existing Age Gate status.
Age Gate Status entry parameters:
userIdentifier - optional String field, external user identifier
Age Gate Service response:
data class AgeEvent (
val status: AgeCheckStatus,
val userIdentifier: String?,
val agId: String?,
val ageRange: AgeRange?,
)
class AgeRange (
val start: Int,
val end: Int,
val jurisdiction: String?,
)
status - enum with values: “Undefined”, “Blocked”, “Allowed”, “Сanceled”, “Pending”,
“ConsentRequired”,“ConsentApproved”, “ConsentDenied”, “AgeVerificationRequired”, “AgeVerified”, “AgeBlocked”,
“IdentityVerificationRequired”, “IdentityVerified”.
userIdentifier - String field, external user identifier
agId - String field, age gate identifier
Please check the Age Gate Status Description here
Method 2: Run
Privo.ageGate.run(data)
data class CheckAgeData (
val userIdentifier: String?,
val birthDateYYYYMMDD: String?,
val birthDateYYYYMM: String?,
val birthDateYYYY: String?,
val countryCode: String?,
)
The method runs the Age Gate check: if the birthdate is passed by a partner or filled in by a user, the method will
return the status "Undefined", "Blocked", "Allowed", "Canceled", "Pending", "ConsentRequired", "ConsentApproved", "
ConsentDenied, "AgeVerificationRequired", "AgeVerified", "AgeBlocked", "IdentityVerificationRequired", "
IdentityVerified", depending on the user’s age and set by a partner configuration parameters.
If the birthdate is not passed, a user will be navigated to the corresponding entry window and forced to fill in the
birthday field.
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).
Response:
data class AgeEvent (
val status: AgeGateStatus,
val userIdentifier: String?,
val agId: String?,
val ageRange: AgeRange?,
)
data class AgeRange (
val start: Int,
val end: Int,
val jurisdiction: String?,
)
status - enum, "Undefined", "Blocked", "Allowed", "Сanceled", "Pending", "ConsentRequired", "ConsentApproved", "
ConsentDenied, "AgeVerificationRequired", "AgeVerified", "AgeBlocked", "IdentityVerificationRequired", "
IdentityVerified"
userIdentifier - optional field, external user identifier
agId - optional field, age gate identifier
Please check the Age Gate Status Description here
Method 3: Age Recheck
ageGate.recheck(data)
data class CheckAgeData (
val userIdentifier: String?,
val birthDateYYYYMMDD: String?,
val birthDateYYYYMM: String?,
val birthDateYYYY: String?,
val countryCode: String?,
)
The method allows rechecking data if the birth date provided by a user was updated.
Age Gate Recheck entry parameters:
userIdentifier - optional field, external user identifier
birthDateYYYYMMDD - optional field, external user birth date in "yyyy-MM-dd" format
countryCode - optional field, two-letter country code (ISO 3166-1 alpha-2 Wiki).
Response:
data class AgeEvent (
val status: AgeGateStatus,
val userIdentifier: String?,
val agId: String?,
val ageRange: AgeRange?,
)
data class AgeRange (
val start: Int,
val end: Int,
val jurisdiction: String?,
)
status - enum, "Undefined", "Blocked", "Allowed", "Сanceled", "Pending", "ConsentRequired", "ConsentApproved", "
ConsentDenied, "AgeVerificationRequired", "AgeVerified", "AgeBlocked", "IdentityVerificationRequired", "
IdentityVerified"
userIdentifier - optional field, external user identifier
agId - optional field, age gate identifier
Please check the Age Gate Status Description here
Method 4: Age Gate Show Identifier Modal
ageGate.showIdentifierModal(userIdentifier)
The method will show a modal dialog with user age gate identifier (can be used to contact customer support)
Age Gate Show Identifier Modal parameters:
userIdentifier - optional string field, external user identifier
Method 5: Hide Age Gate Widget
ageGate.hide()
The method allows a partner to hide the Age Gate widget.
Age Gate Flow Diagrams
Simple Age Gate Flow Diagram
Age Gate Flow Diagram (with Age Recheck)
Age Gate SDK example:
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
ageGate = PrivoAgeGate(this)
}
// ...
ageGate.getAgeStatus(userIdentifier) {
processNewStatus(it?.status)
}
// ...
val data = CheckAgeData(userIdentifier,birthDate,countryCode)
ageGate.run(data) {
processNewStatus(it?.status)
}
// ...
val data = CheckAgeData(userIdentifier,birthDate,countryCode)
ageGate.recheck(data) {
processNewStatus(it?.status)
}
Sample Webhook Response:
{
"id": "861dc238-...-c1dfe",
"status": "Allowed",
"extUserId": "9ede0f0-...a78",
//optional
"countryCode": "US"
//optional
}