Tutorial 4 - Manage your offers

Welcome to the 4th tutorial our dear Developer. What you should know already:

From now on, the main assumption is:

Coding Talking

1. Introduction

Again, we stay close to offers but this time you can learn how to update and deactivate existing offers.

Also, in this tutorial, we will work with Cleeng Sandbox ?.

What can be useful:

  • API Reference - place where you can read about every method we use
  • Example files - package of examples, you should have it already from previous tutorials.

2. Creating offer

The same as in previous tutorial: Cleeng Sandbox

create_offer.php quick guide:

2.1. Create new Cleeng_Api object

$cleengApi = new Cleeng_Api();

2.2. Set publisherToken from Sandbox

$cleengApi->setPublisherToken('YOUR_SANDBOX_PUBLISHER_TOKEN');

2.3. Set endpoint to sandbox.

$cleengApi->enableSandbox();

2.4. Create offerSetup array and use it to create your offer.

$offer = $cleengApi->createRentalOffer($offerSetup);

That's it! You can also check how to create other offers:

3. Update your offer

At first check update_offer.php, as you can see we repeat steps from 2.2 - 2.3 to switch to Sandbox environment.

Because in this Tutorial we are working with Rental offers, read about how to updateRentalOffer in API Reference. Main assumptions connected with changing existing offers are:

  • you have to be the owner of the offer
  • you have to know the id of the offer you want to change

3.1 Set offer ID

$offerId = 'R495315693_PL';

3.2 Set array only with parameters you want to change

E.g. if I want to change only title and period:

$offerSetup = array(
    'title' => 'Super Cool article for just $0.49 with longer access!',
    'period' => '72'
);

3.2 Use it in updateRentalOffer method

$offer = $cleengApi->updateRentalOffer($offerId, $offerSetup);

And it's done! Check how to update different types of offer:

4. Deactivate the offer

About active property you can read in Rental Offer Overview. One and only option to change it is deactivateRentalOffer method. After calling this method, you still will be able to find the offer using e.g. getRentalOffer, but there is no option to make the offer active again!

So, to make the offer disable to purchase you just have to:

  • you have to be the offer owner
  • you have to know the id of the offer you want to disable

3.1 Set offer ID

$offerId = 'R495315693_PL';

3.2 Use it in updateRentalOffer method

$offer = $cleengApi->deactivateRentalOffer($offerId);

And it's gone. If you want to disable different kind of offer:


We use cookies to ensure that we provide you the best service and website experience. Read our Cookie policy for more details.