createPassOffer()


Parameters:

Name Type Description
publisherToken string You can find your publisher token at api-keys page.
offerData object No description
-pricefloatOffer price (in publisher's currency)
-periodstringPass period: week / 2weeks / month / 3months / 6months / year
-expiresAt stringAlternative to "period", specifies exact date when pass expires
-titlestringOffer title, up to 70 chars
-urlstringUrl to content
-associateEmail stringAvailable only for enterprise account
-description stringAdditional offer description, up to 110 chars
-accessToTags arrayTo which tags customer has access. Multiple tags are defined as "OR" (not "AND"). Set "(all)" if you want to give access to all of your offers.
-geoRestrictionEnabled boolSet "true" to enable geo-restriction on this offer
-geoRestrictionType stringChoose type of geo-restriction: whitelist / blacklist
-geoRestrictionCountries arrayBased on geoRestrictionType, set the array of whitelisted/blacklisted countries.

- required parameter


Request:

[
    {
        "method": "createPassOffer",
        "params": {
            "publisherToken": "Xlrx-SjTLVMCsaRsOf2q2hvWKOlrF57yHknDRRRMX-13Fz-x",
            "offerData": {
                "price": "12",
                "period": "month",
                "title": "Get access to every article about finance for whole month!",
                "url": "http:\/\/mywebsite.com\/articles\/about\/finance",
                "description": "Whole month you have unlimited access to every article about finance.",
                "accessToTags": [
                    "finance"
                ]
            }
        },
        "jsonrpc": "2.0",
        "id": 1
    }
]

Response:

[
    {
        "result": {
            "id": "P123123123_US",
            "publisherEmail": "publisher@email.com",
            "title": "Get access to every article about finance for whole month!",
            "description": "Whole month you have unlimited access to every article about finance.",
            "url": "http:\/\/mywebsite.com\/articles\/about\/finance",
            "currency": "USD",
            "country": "US",
            "active": "1",
            "createdAt": 1359121305,
            "updatedAt": 1359121305,
            "price": 13,
            "applicableTaxRate": "0.19",
            "period": "month",
            "accessToTags": [
                "finance"
            ]
        },
        "id": "1",
        "error": null,
        "jsonrpc": "2.0"
    }
]

Example:

<?php
                            
    $publisherToken = 'Xlrx-SjTLVMCsaRsOf2q2hvWKOlrF57yHknDRRRMX-13Fz-x';

    $offerSetup = array(
    'title' => 'Get access to every article about finance for whole month!',
    'price' => 13.00,
    'url' => 'http://mywebsite.com/tag/finance',
    'description' => 'Whole month you have unlimited access to every article about finance.',
    'period' => 'month',
    'accessToTags' => array('finance')
    );

    $cleengApi = new Cleeng_Api();
    $cleengApi->setPublisherToken($publisherToken);
    $cleengOffer = $cleengApi->createPassOffer($offerSetup);
    
?>

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

Back to Pass Offers