Parameters
Name | Type | Description |
---|---|---|
publisherToken* | string | Pass offer id. |
offerData* | object | No description |
-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 |
-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. |
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);
?>