Site Map

Tutorial: Creating paid-links

In this tutorial we will suppose that your web address is http://www.example.com. In practice you should replace this fake address with your own real web address whenever it appears in this tutorial.

 

Create the test1.html file with the following content:

 
<!DOCTYPE HTML>
<head>
 
<script src="http://www.icents.us/iCents.js" type="text/javascript" charset="iso-8859-1"></script>
<div id="iCents">iCents</div><script>iCents.Init()</script>
 
</head>

<body style="text-align:left;background-color:#cfc">
<center><b>TEST-1</b></center>
<p>

<a href="javascript:void(0)" price="US$ 0.50" duration="10" unlock="http://www.example.com/test" appendable="true">
   <img price="buttonText" style="border:0px">
</a>

<p>
<a href="test2.html" price="US$ 0.10" unlock="http://www.example.com/test2.html">click here to go to TEST-2</a>
</body>

 

Now create the test2.html file with the following content:

 
<!DOCTYPE HTML>
 
<head>
 
<script src="http://www.icents.us/iCents.js" type="text/javascript" charset="iso-8859-1"></script>
<div id="iCents">iCents</div><script>iCents.Init()</script>
 
</head>

<body style="text-align:right;background-color:#ffc">
<center><b>TEST-2</b></center>
<p>

<a href="javascript:void(0)" price="US$ 0.50" duration="10" unlock="http://www.example.com/test" appendable="true">
   <img price="buttonText" style="border:0px">
</a>

<p>
<a href="test1.html" price="US$ 0.20" unlock="http://www.example.com/test1.html" >click here to go to TEST-1</a>
</body>

 

Place these files in your web server so that they can be accessed at the following addresses:

http://www.example.com/test1.html

http://www.example.com/test2.html

 

Attention: Once again, when following the instructions above, do not forget to replace http://www.example.com with your own web address in the test1.html and test2.html files.

Result

The result is shown below. We have two pages, TEST-1 and TEST-2, each containing a paid-link that opens the other page. In addition, both pages have a micro-subscription button that, when paid, unlocks the paid-links of both pages for 10 minutes.

 

Explanation

 

The code below initializes the iCents.net API on the page:

<script src="http://www.icents.us/iCents.js" type="text/javascript" charset="iso-8859-1"></script>
<div id="iCents">iCents</div><script>iCents.Init()</script>

 

The code below creates a micro-subscription button costing 50 cents for the duration of 10 minutes:

<a href="javascript:void(0)" price="US$ 0.50"
   duration="10"
   unlock="http://www.example.com/test"
   appendable="true">
   
      <img price="buttonText" style="border:0px">
      
</a>

The code unlock="http://www.example.com/test" in combination with appendable="true" unlocks all URLs that start with http://www.example.com/test. Since the URLs of the test pages are covered by this definition, these pages are unlocked when the micro-subscription is paid:

  http://www.example.com/test1.html
  http://www.example.com/test2.html

 

The code below creates a paid-link costing 10 cents. It unlocks the page for use only once per payment, since there is no duration attribute.

Since here there is no appendable attribute, unlock="http://www.example.com/test2.html" unlocks only the URL that is exactly the same as http://www.example.com/test2.html

<a href="test2.html" price="US$ 0.10"
   unlock="http://www.example.com/test2.html"
   >click here to go to TEST-2</a>

Testing files located on your own desktop computer

The above explanation assumes that you are the owner of a website and can upload files to the hosting server. However, to test and see your paid-links working, you can also use iCents.net from you local computer (using file:/// protocol).

Please note that even if you use local pages you still need to have an Internet connection, because other needed codes are loaded real time from iCents.net.

Also note that Firefox 3.0/3.5+ prevents local access unless you change a system preference to allow it. To do so, enter about:config in the Firefox address bar and change the preference security.fileuri.strict_origin_policy to false.

Alternatively, you can install a web server on your local computer and edit the local hosts file.

Next steps

We suggest that you continue on the following pages:


ready for
printing