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

Name

Type

Description

offerId*

string

ID of the offer for which access is checked

callback*

string

function called after popup window is closed (see example below)

* - required parameter

Result Parameters

Name

Type

Description

accessGranted

boolean

Information about user's access to given offer

grantType

string

Information about method granting access for customer

expiresAt

integer

Expiration date for access to given offer. This value is approximate, parameter accessGranted contains valid information about user's access

purchasedDirectly

boolean

deprecated

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
    }