Site Map
Tools
Authorizations:
›› remove

 

donate Attribute

With the donate attribute, iCents.net allows for an easy creation of paid-links so that Internet users can make donations. They are called donation links.

To create a donation link, place the donate="true" attribute in the tag of the paid-link. For example, this is a donation link, whose HTML coding is as follows:

<a href="javascript:void(0)" price="US$ 0.10"
 donate="true"
 >This is a donation link</a>

 

Or you can have a whose HTML coding is as follows:

<button price="US$ 0.10" donate="true">donation button</a>

Preventing the Internet user to donate twice in a row

In the examples above, the Internet user could theoretically click donation links more than once since they continue to display the price in the same way, soon after each payment.

However, when the Internet user has just made a donation, it is advisable that you show your appreciation and that the amount donated is enough; at least for a while.

To prevent the Internet user from donating several times in a row, use the duration attribute together with the unlock attribute. For example, this is a donation link whose duration="10". This means that during 10 minutes after payment, the link will show a "Thank you!" message when the mouse is over it. It will also not be possible to click this link and make another donation during these 10 minutes. See the HTML code of this link below:

<a href="javascript:void(0)" price="US$ 0.10"
 donate="true"
 duration="10"
 unlock="abc"
 >this is a donation link</a>

Note that you also need to provide the unlock attribute since the duration attribute does not work without unlock. In the example above, we used unlock="abc", where abc is only an identifier, any name that must be unique to each donation paid-link, if you want each link to be independent from each other.

If you want that many donation links are locked when one of them has been paid, provide the same unlock attribute for all of them. For example:

donate 10 cents

donate 20 cents

 

<a href="javascript:void(0)" price="US$ 0.10"
 donate="true"
 duration="10"
 unlock="this is some unlock"
>donate 10 cents</a>
 
 <a href="javascript:void(0)" price="US$ 0.20"
 donate="true"
 duration="10"
 unlock="this is some unlock"
 >donate 20 cents</a>

Informing the Internet user about a successful donation

When the Internet user makes a donation, it is advisable that you immediately inform him or her that the payment was successful. In the examples above, nothing happens after payment is made by the Internet user; which could make the donor wonder whether the process worked or not.

There are two possibilities to show the Internet user the donation worked:

For example:

this donation link uses a thank you page.

this donation link uses the event onafterok to open an alert.

 

<a href="ThankYouPage.html" price="US$ 0.10"
 donate="true"
 duration="10"
 unlock="someText1"
 >donate here</a>

 <a href="javascript:void(0)" price="US$ 0.20"
 onafterok="alert('thank you.')"
 donate="true"
 duration="10"
 unlock="someText2"
 >donate here again</a>

 

Invalidating the href

When you use the onafterok event to open an alert, and you do not want any page to open, you must invalidate the href. Invalidating the href attribute means to prevent the link to open any page when it is paid. You can do that in many ways. One of them is to use href="javascript:void(0)". This means that when the link is clicked, it will execute a JavaScript command that does nothing.

However, iCents.net provides a simpler way to invalidate a href attribute. All you need to do is enter href="icents:". The advantage of this method is that it prevents the javascript:void(0) text from appearing in the browser's status bar. For example:

this a link with invalidated href

 

<href="icents:"
onafterok="alert('thank you.')"
price="US$ 0.10"
donate="true"
>this is a link with invalidated href</a>

Interaction with Other Paid-Link Attributes

Interaction of the donate and duration Attributes

A link with donate="true" is called a donation link. When used with the duration attribute, the donation link has the following behavior:

Interaction of the donate and unlock Attributes

In a regular paid-link, the unlock attribute determines which content must be unlocked after payment. In the case of donation links, there is usually no content to be unlocked, and therefore there is no need for the unlock to be the content URL.

When unlock is used, however, it will be unlocked as with any other paid link. This is why you should be careful when creating micro-subscriptions as to not unlock the donation links and prevent them from being used.

Troubleshooting