These docs are for v2.0. Click to read the latest docs for v2.1.

getAccessStatus()

Usage

Returns the information if current visitor has access to selected offer.

CleengApi.getAccessStatus(offerId, callback);

There are two ways of using this method. The first is checking access to one, particular offer for some country like for US (look at the request example).

The second way is to check if the user has access to the offer in any country. To do so, just skip the country tag suffix. For example:

Offer ID WITH the country suffix:

S580476507_US

The same offer ID WITHOUT country suffix:

S580476507

📘

Note: This method is not secure and should be used only as a helper method. Your integration entitlement validation should be based on server side getAccessStatus method.

Parameters

NameTypeDescription
offerId*stringID of the offer for which access is checked
callback*stringfunction called after popup window is closed (see example below)

* - required parameter

Result Parameters

NameTypeDescription
accessGrantedbooleanInformation about user's access to given offer
grantTypestringInformation about method granting access for customer
expiresAtintegerExpiration date for access to given offer. This value is approximate, parameter accessGranted contains valid information about user's access
purchasedDirectlybooleandeprecated

API Request/Response

JS example

CleengApi.getAccessStatus('S543962233_US', function(result) {
        if (result.accessGranted) {
            alert('You have access to this offer!');
        }
    });

Response

{
        accessGranted: true,
        grantType: "direct-purchase",
        expiresAt: "1455899791",
        purchasedDirectly: true
    }