[DISABLED 02.02.2022 in v2.1 and Contents moved to API Reference> Offer Management (JSON-RPC) > General Offer Management]
This article will help you to create a subscription plan, pass offers and learn how to use tags assigned to each offer.
What exactly you can find in this tutorial:
- how to create & properly describe your subscription/pass plan,
- how to point offers covered by the subscription/pass plan
Creating and managing subscription offers is similar to offer types. To understand better, let's create offer which will be a monthly subscription to your articles about Finances and Politics.
$offerSetup = array( 'title' => 'Subscribe fresh news about Finances and Politics', 'price' => 19.00, 'url' => 'http://your-site.com/', 'description' => 'Get access to all of your favourite articles about Finances and Politics for 19$/month', 'period' => 'month', 'accessToTags' => array('Finance', 'Politics') ); $cleengApi = new Cleeng_Api(); $cleengApi->setPublisherToken('YOUR_PUBLISHER_TOKEN'); $cleengApi->createSubscriptionOffer($offerSetup);
period - How often to bill the user. week / month / 3months / 6months / year
accessToTags - Describe which offers you want to cover by you subscription offer.
- To cover all of your offers by subscription plan, just set 'accessToTags' => array('(all)')
- Multiple tags are defined as "OR" (not "AND").
Pass offers are totally similar to subscriptions. The only difference is that after purchasing Pass offer, the customer is billed only once! and has access to your content for the period you set in pass parameters. Also, instead of the period parameter, you can use
expiresAt and set unix timestamp expire date.
To summarise, you can give your customers one-time access for a whole day to every article about finance,
period = 'day'
accessToTags = array('finance')
- access till (any date) to every video about health food.
expiresAt = 'some date (unix timestamp)'
accessToTags = array('health food')
Your offers have to be tagged properly and compatible with the 'accessToTags' param from the subscription plan.
$offerSetup = array( 'title' => 'Most important news from Politics / July 2020', 'price' => 3.99, 'url' => 'http://your-site.com/most_important_news_from_politcs_july', 'contentType' => 'article', 'description' => 'Catch up the most important facts from Politics', 'tags' => array('Politics', 'July2020') ); $cleengApi = new Cleeng_Api(); $cleengApi->setPublisherToken('YOUR_PUBLISHER_TOKEN'); $cleengApi->createSingleOffer($offerSetup);
Focus on the line: 'tags' => array('Politics', 'July2020')
Only after 'tags' array param your offer is tagged and tag 'Politics' will be connected with the subscription plan which we created above in the 1st point. That offer can also be connected with other subscription plans with e.g. "every article from July 2020" using the tag 'July2020'.
- To cover all of your offers by subscription plan/pass, just set 'accessToTags' => array('(all)'), read above (1st point)
- Multiple tags are defined as "OR" (not "AND"),
- Subscription plan/pass can cover single, rental and event offers only,
- If your subscription plan/pass contain rental offers, period parameter doesn't count anymore for customers with an active subscription, they have access to your rental offer for whole subscription period,
- Periods in subscription plans / Passes: week / month / 3months / 6months / year
Updated almost 2 years ago