getAccessStatus()

Returns information about logged in user access to offer.

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.
ipAddress string Customer IP address.
- required parameter

Request:

    {
    "method": "getAccessStatus",
    "params": {
    "customerToken": "GeO3HV8Zmf4o4ID6QPBwRDghN9MXGiOLekgmXlKW-yJWpN-j",
    "offerId": "S580476507_US",
    "ipAddress": ""
    },
    "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->getAccessStatus($offerId);

    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 - getAccessStatus()

Back to Customer API