createPassOffer()

Parameters:

Name Type Description
publisherToken string You can find your publisher token at api-keys page.
offerData object
-   price float Offer price (in publisher's currency)
-   period string Pass period: week / 2weeks / month / 3months / 6months / year
-   expiresAt string Alternative to "period", specifies exact date when pass expires
-   title string Offer title, up to 70 chars
-   url string Url to content
-   associateEmail string Available only for enterprise account
-   description string Additional offer description, up to 110 chars
-   accessToTags array To 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 bool Set "true" to enable geo-restriction on this offer
-   geoRestrictionType string Choose type of geo-restriction: whitelist / blacklist
-   geoRestrictionCountries array Based 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