getAccessStatusForDevice()

Returns information about logged in user access to offer, based on used device.

Parameters:

Name Type Description
customerToken string Token that identifies the customer, read more in Must know about API section.
offerId string Set offerId and check if customer has access to the offer.
deviceId string Device unique id
deviceType string Device type, e.g. 'roku'
- required parameter

Request:

    {
    "method": "getAccessStatusForDevice",
    "params": {
    "customerToken": "GeO3HV8Zmf4o4ID6QPBwRDghN9MXGiOLekgmXlKW-yJWpN-j",
    "offerId": "S580476507_US",
    "deviceId": "your_device_unique_id",
    "deviceType": "name_of_device_you_integrate_with"
    },
    "jsonrpc": "2.0",
    "id": 1
    }

Response:

    {
    "result": {
    "accessGranted": true,
    "grantType": "direct-purchase",
    "expiresAt": null,
    "socialCommissionUrl": null
    },
    "id": "1",
    "error": null,
    "jsonrpc": "2.0"
    }

Example:

<?php
    $offerId = 'S580476507_PL';

    $cleengApi =  new Cleeng_Api();

    $offerAccess = $cleengApi->getAccessStatusForDevice($offerId, 'device_unique_id', 'roku');

    if($offerAccess->accessGranted) {
    //user has access to the content. Put your content here,
    } else {
    //user has no access, show 'Buy' button. Read more in Tutorial 1 - Protect you content
    }
    

Remember! you can always check it by yourself using API Console - getAccessStatusForDevice()

Back to Entitlement API