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,nickname)

The method allows checking the existing Age Gate status.

Age Gate Status entry parameters:

userIdentifier - optional field, external user identifier (please don't use empty string ("") as a value. It will cause an error. We support real values or null if you don't have it)

nickname - optional field, nickname (please use only in case of multi-user integration. Please don't use empty string "" in it)

Age Gate Service response:

data class AgeEvent (
  val status: AgeCheckStatus,
  val userIdentifier: String?,
  val nickname: 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

nickname - String field, nickname

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 nickname: String?,
  val birthDateYYYYMMDD: String?,
  val birthDateYYYYMM: String?,
  val birthDateYYYY: String?,
  val age: Int?,
  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", "MultiUserBlocked", "AgeEstimationBlock", "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 (please don't use empty string ("") as a value. It will cause an error. We support real values or null if you don't have it)

nickname - optional field, nickname (please use only in case of multi-user integration. Please don't use empty string "" in it)

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. Derived birthDate will be calculated with Dec 31 by default
age - optional field, external user age format. Derived birthDate will be calculated with current day and month by default

countryCode - optional field, two-letter country code (ISO 3166-1 alpha-2 Wiki).

Response:

data class AgeEvent (
  val status: AgeGateStatus,
  val userIdentifier: String?,
  val nickname: String?;
  val agId: String?,
  val ageRange: AgeRange?,
)

data class AgeRange (
  val start: Int,
  val end: Int,
  val jurisdiction: String?,
)

status - enum, "Undefined", "Blocked", "MultiUserBlocked", "AgeEstimationBlock", "Allowed", "Сanceled", "Pending", "ConsentRequired", "ConsentApproved", " ConsentDenied, "AgeVerificationRequired", "AgeVerified", "AgeBlocked", "IdentityVerificationRequired", " IdentityVerified"

userIdentifier - optional field, external user identifier

nickname - optional field, nickname

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 nickname: String?;
  val birthDateYYYYMMDD: String?,
  val birthDateYYYYMM: String?,
  val birthDateYYYY: String?,
  val age: Int?,
  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 (please don't use empty string ("") as a value. It will cause an error. We support real values or null if you don't have it)

nickname - optional field, nickname (please use only in case of multi-user integration. Please don't use empty string "" in it)

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. Derived birthDate will be calculated with Dec 31 by default
age - optional field, external user age format. Derived birthDate will be calculated with current day and month by default

countryCode - optional field, two-letter country code (ISO 3166-1 alpha-2 Wiki).

Response:

data class AgeEvent (
  val status: AgeGateStatus,
  val userIdentifier: String?,
  val nickname: String?,
  val agId: String?,
  val ageRange: AgeRange?,
)

data class AgeRange (
  val start: Int,
  val end: Int,
  val jurisdiction: String?,
)

status - enum, "Undefined", "Blocked", "MultiUserBlocked", "AgeEstimationBlock", "Allowed", "Сanceled", "Pending", "ConsentRequired", "ConsentApproved", " ConsentDenied, "AgeVerificationRequired", "AgeVerified", "AgeBlocked", "IdentityVerificationRequired", " IdentityVerified"

userIdentifier - optional field, external user identifier

nickname - optional field, nickname

agId - optional field, age gate identifier

Please check the Age Gate Status Description here

Method 4: Age Gate Link User

ageGate.linkUser(userIdentifier,agId,nickname)

The method will link user to specified userIdentifier. It's used in multi-user flow, when account creation (on partner side) happens after age-gate. Please note that linkUser can be used only for users that doesn't have userIdentifier jet. You can't change userIdentifier if user already have it.

userIdentifier - external user identifier (please don't use empty string ("") as a value. It will cause an error. We support real values or null if you don't have it)

agId - age gate identifier that you get as a response from sdk on previous steps

nickname - optional field, nickname (please use only in case of multi-user integration. Please don't use empty string "" in it)

Method 5: Age Gate Show Identifier Modal

ageGate.showIdentifierModal(userIdentifier, nickname)

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 field, external user identifier (please don't use empty string ("") as a value. It will cause an error. We support real values or null if you don't have it)

nickname - optional field, nickname (please use only in case of multi-user integration. Please don't use empty string "" in it)

Method 6: 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
Simple Age Gate Flow Diagram

Age Gate Flow Diagram (with Age Recheck)
Age Gate Flow Diagram

Age Gate MultiUser Flow Diagram
Age Gate MultiUser Flow Diagram

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 SDK Response:

{
  "id": "861dc238-...-c1dfe",
  "status": "Allowed",
  "extUserId": "9ede0f0-...a78",
  //optional
  "countryCode": "US"
  //optional
}