createPassOffer

📘

You can try that method by clicking here

Parameters

NameTypeDescription
publisherToken*stringPass offer id.
offerData*objectNo 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
-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.

API Request/Response

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":"[email protected]",
      "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"
}

PHP 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);
    
?>