Sell digital downloads – pros and cons of different methods

Sell Digital DownloadsThis article is about some of the decisions that you have to make about selling digital downloads on line. Digital content can be a great way to expand your web site presence, add to your existing physical shop or sell download content that you have created. There are many solutions to choose from and this article will explain issues that you will need to consider.

What is the Basic process of selling a digital product?

Digital products can be mp3 and mp4 files, templates for applications like WordPress, software applications, graphics, icons, and so on. Each of these will have particular requirements for you but the basic process of selling a digital product is essentially the same:

  1. Upload the files that you are going to sell to a web site.
  2. Create a buy now button or add to cart button and place on your web site page.
  3. When the customer clicks on the purchase button, it takes them to the payment processor such as PayPal.
  4. The customer makes the purchase and you receive confirmation of the purchase by email.
  5. You send the product to the customer either automatically using a mechanism associated with the payment processor or you may have some other method like sending the product manually by email at some later time.

What are the ways to sell digital products?

Essentially, there are two ways to sell your products:

  1. From your own web site using some sort of ecommerce application on your site.
  2. Form a third party web site that provides all the functionality for you.


Let’s look at the advantages and disadvantages of these.

Selling from your own web site:

First, you need to think about a shopping application that you can use to sell your products. This could be a product like PHP-eSeller, which is a PHP / MySQL application, or you could go for something like a WordPress installation and install an eCommerce plugin.

Selling from your own web site means that you will have complete control over the look and feel of the site. It also means you have control over the security of your digital products, that is you are not uploading them to someone else’s web site.

You will need a web site with a domain name, which involves understanding web site development and there will be some cost for the hosting plan of course.

If you are technically able, you can create your own web site but you could hire someone to do that. You could also consider a pre-built system like installing WordPress, which could make it easier for you to design your site.

If you are going to build your own site, try to ensure it is fully responsive, so that it works on different devices, desktop computers, tablets and phones.

You will have to set up the shopping application yourself unless you hire someone else to do it. Setting it up yourself may not be a significant issue, as modern applications should install easily.

Selling from a third party site

You will have to find a suitable company that provides a service to sell your digital products. There are many of these but they will charge a subscription so there will be an extra cost and this could be a problem if you only sell a small number a month. Subscriptions vary but usually they are on a per month basis and sometimes depend on the number of digital products or the file size.

You will be sheltered from many technicalities and it should be possible to set up and begin selling quite quickly.
You could have a wide range of payment processors to choose from which may be an advantage.

If you have problems with the system, there will be some kind of help desk available.

Security of your digital content

The security of your digital files is very important, so there should be a way of making sure that any digital files you upload cannot be download unless they were purchased.

If you are selling from your own web site, there are a number of ways of securing your files, which will be described with the shopping cart application that you are using. This often means the use of an htaccess file.

If you are using a third party web site, they should have a built in system that provides the required security. Make sure that you check with the company to ensure that your files are safe.

The type of processing that you need should include:

  1. The download link is unique to each customer.
  2. Downloading via the supplied link is limited in number of attempts and time.
  3. The files that are being sold can only be accessed with the download link – that is, it is not possible to download using a normal URL
  4. The processing with the payment system (PayPal for example) must make the download link available only after the customer has paid.

Music Download sites

Audio Files to sell Digital ContentsYou may be selling digital files that are specifically for music, in which case you may want to look for a system that allows you to upload audio preview files as well as the audio files for sale.
PHP-eSeller has a number of shopping displays intended specifically for music files.

Buy Now or Cart Functions

Buy now buttons are where the customer clicks the button and is immediately taken to the payment page. There is no opportunity to continue shopping or add more products to the shopping basket.

This may be good enough if you only have a few items to sell. If you are selling many items then a shopping cart system is needed, as it will allow the customer to add many products into their basket.

Shopping Cart systems use add to cart and view cart buttons.

Do you need a full-blown system

Sometimes having a super eCommerce web site is just not needed and you may be happy with a system where someone makes a purchase using PayPal for instance, and then you send the product on by email. In that case, you could create your own web site and add a few PayPal buttons.

If you want something more integrated where the product is delivered as soon as the money is in your account, then you need something more sophisticated.

For this you need a system like PayPal IPN where a special code is sent from PayPal as soon as a purchase is made. It is this code that triggers a process to send the purchased item to the customer.

Consider the Checkout process

What payment processor should you use? There are many payment processors around now, but some of them are quite obscure and new. It might be good to go for a lesser-known payment processor that may have lower fees, but if you were a purchaser, would you want to trust your payment through a company you have never heard of?
Digital products allow you to sell all over the world, as there is no shipping of goods, so you need to ensure that customers from different countries can pay you. So make sure you choose a payment processor that is known and available in different countries.

When you look at a shopping application, you will need to decide what kind of processing you want. Some shopping systems ask the customer to sign up before they make a payment that can slow down the purchasing process. Other systems aim for a simpler one-step process where the customer is not asked unnecessary questions. This can be particularly important where the customer is buying only one item.

Does the payment processor have a secure system for communicating with the application? When a customer makes a purchase, it normally sends a set of data to the shopping system. It is important to make sure that this data uses a secure method.

What sort of additional facilities do you need?

Other features that you need to check on are:

  1. Customise templates. Are you able to change the layouts of pages, or buttons?
  2. Customise emails. Can you easily modify the email text and layout to suit your requirements?
  3. Different payment providers. Does the system allow the use of different payment systems?

Do you need someone to do your marketing for you?

At some point, you will need to consider marketing your digital goods. If you are developing your own web site then that is going to be entirely your responsibility. You can of course hire someone to help.

Do I need a system to sell physical goods at the same time as digital goods?

One of the reasons to sell digital goods is there they have no shipping costs. You can sell the same product repeatedly and there is no stock to maintain. However, you may want to sell physical items as well. If you do then you need a shopping system that is able to handle international shipping costs. As you can imagine, this can be a very complicated issue and needs quite a lot of setting up – that is why many people only sell digital items.

Systems that are able to handle international shipping usually have a way to set shipping costs per destination. So you may have a shipping cost for your own country, then a cost for Europe, and so on. The application PHP-eSeller has this feature built in.

And finally …

I have tried to explain some of the points that you should consider for a digital download system. Look around the internet and investigate applications that you install onto your web site as well as those organisations that provide a complete service.

Go to PHP-eSeller

Use PHP-eSeller to sell your downloads online and sell physical items as well.

A Shopping Cart using PHP Sessions

This posts illustrates a relatively simple shopping cart in PHP using sessions to store cart details, quantities and total cart amount.  The cart has an add to cart button , remove from cart button and displays the total value of the cart.

This post is taken from part of the book PHP Tutorials: Programming with PHP and MySQL which is available as a paper back printed version or as a downloadable Kindle version. Click here for paper back version.

The following listing is the complete shopping cart in PHP:

<?php session_start();
#cart.php - A simple shopping cart with add to cart, and remove links
 //---------------------------
 //initialize sessions

//Define the products and cost
$products = array("product A", "product B", "product C");
$amounts = array("19.99", "10.99", "2.99");

//Load up session
 if ( !isset($_SESSION["total"]) ) {
   $_SESSION["total"] = 0;
   for ($i=0; $i< count($products); $i++) {
    $_SESSION["qty"][$i] = 0;
   $_SESSION["amounts"][$i] = 0;
  }
 }

 //---------------------------
 //Reset
 if ( isset($_GET['reset']) )
 {
 if ($_GET["reset"] == 'true')
   {
   unset($_SESSION["qty"]); //The quantity for each product
   unset($_SESSION["amounts"]); //The amount from each product
   unset($_SESSION["total"]); //The total cost
   unset($_SESSION["cart"]); //Which item has been chosen
   }
 }

 //---------------------------
 //Add
 if ( isset($_GET["add"]) )
   {
   $i = $_GET["add"];
   $qty = $_SESSION["qty"][$i] + 1;
   $_SESSION["amounts"][$i] = $amounts[$i] * $qty;
   $_SESSION["cart"][$i] = $i;
   $_SESSION["qty"][$i] = $qty;
 }

  //---------------------------
  //Delete
  if ( isset($_GET["delete"]) )
   {
   $i = $_GET["delete"];
   $qty = $_SESSION["qty"][$i];
   $qty--;
   $_SESSION["qty"][$i] = $qty;
   //remove item if quantity is zero
   if ($qty == 0) {
    $_SESSION["amounts"][$i] = 0;
    unset($_SESSION["cart"][$i]);
  }
 else
  {
   $_SESSION["amounts"][$i] = $amounts[$i] * $qty;
  }
 }
 ?>
 <h2>List of All Products</h2>
 <table>
   <tr>
   <th>Product</th>
   <th width="10px">&nbsp;</th>
   <th>Amount</th>
   <th width="10px">&nbsp;</th>
   <th>Action</th>
   </tr>
 <?php
 for ($i=0; $i< count($products); $i++) {
   ?>
   <tr>
   <td><?php echo($products[$i]); ?></td>
   <td width="10px">&nbsp;</td>
   <td><?php echo($amounts[$i]); ?></td>
   <td width="10px">&nbsp;</td>
   <td><a href="?add=<?php echo($i); ?>">Add to cart</a></td>
   </tr>
   <?php
 }
 ?>
 <tr>
 <td colspan="5"></td>
 </tr>
 <tr>
 <td colspan="5"><a href="?reset=true">Reset Cart</a></td>
 </tr>
 </table>
 <?php
 if ( isset($_SESSION["cart"]) ) {
 ?>
 <br/><br/><br/>
 <h2>Cart</h2>
 <table>
 <tr>
 <th>Product</th>
 <th width="10px">&nbsp;</th>
 <th>Qty</th>
 <th width="10px">&nbsp;</th>
 <th>Amount</th>
 <th width="10px">&nbsp;</th>
 <th>Action</th>
 </tr>
 <?php
 $total = 0;
 foreach ( $_SESSION["cart"] as $i ) {
 ?>
 <tr>
 <td><?php echo( $products[$_SESSION["cart"][$i]] ); ?></td>
 <td width="10px">&nbsp;</td>
 <td><?php echo( $_SESSION["qty"][$i] ); ?></td>
 <td width="10px">&nbsp;</td>
 <td><?php echo( $_SESSION["amounts"][$i] ); ?></td>
 <td width="10px">&nbsp;</td>
 <td><a href="?delete=<?php echo($i); ?>">Delete from cart</a></td>
 </tr>
 <?php
 $total = $total + $_SESSION["amounts"][$i];
 }
 $_SESSION["total"] = $total;
 ?>
 <tr>
 <td colspan="7">Total : <?php echo($total); ?></td>
 </tr>
 </table>
 <?php
 }
 ?>

The cart example uses the following sessions to maintain the state of the cart:

$_SESSION[“qty”][i] Stores the quantity for each product
$_SESSION[“amounts”][i] Stores the price from each product
$_SESSION[“cart”][i] Identifies which items have been added to the cart
$_SESSION[“total”] Stores the total cost

The sessions are actually arrays so in the case of:

$_SESSION[“qty”][i]

is the quantity for the element with number i.

Description of the PHP shopping cart code

We start by defining PHP to use sessions by:

session_start();

This has to be at the very top of the PHP page.

Next we set up our products and populate our sessions. In this example we are using a fixed array of product descriptions and amounts. You may want to do this in your application or you could read in the data into the $product and $amounts array from a database.

//---------------------------
 //initialise sessions

 //Define the products and cost
 $products = array("product A", "product B", "product C");
 $amounts = array("19.99", "10.99", "2.99");

 if ( !isset($_SESSION["total"]) ) {

  $_SESSION["total"] = 0;

  for ($i=0; $i< count($products); $i++) {
   $_SESSION["qty"][$i] = 0;
   $_SESSION["amounts"][$i] = 0;
 }
}

The following code will reset and clear the sessions when the Reset Cart link is selected.

//---------------------------
  //Reset
  if ( isset($_GET['reset']) )
   {
    if ($_GET["reset"] == 'true')
    {
     unset($_SESSION["qty"]); //The quantity for each product
     unset($_SESSION["amounts"]); //The amount from each product
     unset($_SESSION["total"]); //The total cost
     unset($_SESSION["cart"]); //Which item has been chosen
   }
}

The following code adds an item to the sessions when the ‘Add to Cart’ link is clicked:

//---------------------------
//Add
if ( isset($_GET["add"]) )
{
$i = $_GET["add"];

$qty = $_SESSION["qty"][$i] + 1;

$_SESSION["amounts"][$i] = $amounts[$i] * $qty;
$_SESSION["cart"][$i] = $i;
$_SESSION["qty"][$i] = $qty;
}

and the following deletes an item from the cart when the ‘Delete from Cart’ link is clicked:

 //---------------------------
 //Delete
 if ( isset($_GET["delete"]) )
 {
   $i = $_GET["delete"];
   $qty = $_SESSION["qty"][$i];
   $qty--;
   $_SESSION["qty"][$i] = $qty;

 //remove item if quantity is zero
 if ($qty == 0) {
   $_SESSION["amounts"][$i] = 0;
   unset($_SESSION["cart"][$i]);
 }
 else
 {
   $_SESSION["amounts"][$i] = $amounts[$i] * $qty;
 }
 }

The rest of the code is the visual display using a table and various loops to show the product lists and the cart details together with the links.

This post is taken from part of the book PHP Tutorials: Programming with PHP and MySQL which is available as a paper back printed version or as a downloadable Kindle version. Click here for paper back version.

PHP-eSeller is a complete application that utilizes a shopping cart using PHP Sessions and is available from here:

Click here to go to PHP-eSeller web page

Do I need SSL on my Web Server for use with PayPal IPN?

PayPal upgrades:

1) Changes to PayPal security for HTTP/1.1 and TLS 1.2
2) IPN Verification Postback to HTTPS

PayPal say their target for these is June 2018

 

You may have seen an article from PayPal which talks about HTTP and TLS. This is a server issue
which is the responsibility of your web host. Essentially there is an upgrade by PayPal to ensure that
all their servers meet the latest standards and hence your web server will also require to operate
in that way. You should contact your host about this if you are unsure, although most servers will already
meet these standards.

 

The second update is using HTTPS for IPN verification.

PayPal says:

“If you are using PayPal’s instant Payment Notification (IPN) service, you will need to ensure
that HTTPS is used when posting the message back to PayPal for verification. HTTP PostBacks
will no longer be supported.”

“Merchants and partners use Instant Payment Notification (IPN) to receive notifications of
events related to PayPal transactions. The IPN message service requires that you acknowledge
receipt of these messages and validate them. This process includes posting the messages back
to PayPal for verification. In the past, PayPal has allowed the use of HTTP for these
PostBacks . For increased security going forward, only HTTPS will be allowed for PostBacks to
PayPal. At this time, there is no requirement for HTTPS on the outbound IPN call from PayPal
to the merchant’s IPN listener.”

In practice this means that you need https on your web server to send https to PayPal and
then you need to change the set up of you PHP-KeyCodes, PHP-eSeller or PHP-SecureArea
application to identify the URL of the site as https rather than http.

Note: if a customer tried to make a purchase it would still succeed, but your store would
not be notified of that fact, and your records will not reflect the sale properly. Nor
will the PHP application automatically send the information to the customer by email.

Refer to PayPal documentation:

https://www.paypal.com/au/webapps/mpp/ipn-verification-https

So do I need SSL on my Web Server when using PayPal IPN? Yes, the PostBack from PayPal will not work
and SSL will give better security for your site.

An HTML5 Audio Player using a Customized Image

HTML 5 is able to play audio in a browser without the need for a plugin. In the long run, HTML 5 will probably put an end to audio plugins such as Microsoft Windows Media Player, Silverlight and Adobe Flash.

The audio player download provided here consists of JavaScript and css that give a customized version of the HTML 5 audio. You may use it as is on a web page or you may want to modify it to show a different image. At present there is no WordPress plugin for the code.

This code is also used in the PHP-eSeller application for audio previews.

 

Click here for a full description

 

Click here to download

New version of PHP-eSeller PHP Shopping Cart Digital Goods

PHP-eSeller has been updated to include fully responsive displays on the admin and public shopping cart displays so that they work well on all types of devices, mobile, tablets and desktop.

PHP-eSeller

Some of the cart displays now use the JQuery Datatable system that can be easily modified to change formatting and add in other options.

The JQuery Datatable plugin is well documented, is very extensive and has many features and functions.

Other shopping cart displays are based on the latest version of Twitter Bootstrap which is a framework to ensure that displays work well on different device types. Bootstrap is a well known framework which can be easily changed and modified to work with your particular layout. It is also very well documented with many forum sites.

PHP-eSeller has been completely re-written and is fully compatible with PHP 7 servers.

 

Twitter Bootstrap PHP Cart System

Live Demo

 

Datatable Cart System with HTML Audio Preview and no formatting

Live Demo

 

Datatable Cart System including Twitter Bootstrap

Live Demo

A guide to sell digital downloads online using a PHP Shopping Cart

Digital goods, electronic goods, digital products or e-goods are anything you can sell that is in a digital format.  The types of products include ebooks, software, website templates, music, videos, license codes, ringtones and pdf tutorials.  The costs of adding a digital item to a shopping system is very small so it can be a great way make a steady income.

A PHP shopping cart with add to cart buttons can be combined with selling digital downloads as used in the PHP-eSeller application.

Here are just a few of the advantages to selling digital downloads using a specially designed PHP shopping cart:

• No inventory – you have no stock levels to maintain so you have no storage problems or supply problems.
Costs are the same to sell one or thousands digital goods.
No postage costs.
• The customer will instantly receive the product using a digital download system.
• The transaction is quickly completed so you have the money in your account straight away.

Some online services specialize in selling digital goods, including invoicing, payment, and delivering the digital copy for you.  In that case, you have to pay some sort of fee to the service provider.

Alternatively you can have a PHP shopping cart on your web site that you install yourself or get a developer to install for you.

Choosing a PHP Shopping cart can be difficult, here’s some guidelines to help you get started:

1) Fees

The payment system that the shopping system uses will have some kind of transaction fees.  This will vary so check what they require and what you can afford. Selling through PayPal is often a convenient way and they use a transaction fee.

2) Integration with your website

Make sure the shopping cart can be integrated with your website.  This may be by modifying a template system or by adding buttons to your existing web pages.

3) Features

Here’s a few of the features that might be helpful:
* Automatic product download
* Have the option of no shipping
* The ability to simultaneous sell tangible goods and e-goods

4) Security

It’s important that the purchase made by the customer is secure. You should expect your customer, after purchasing your product, to receive a secure link to immediately download the purchased item. The link should expire within a certain amount of time.

5) Easy to Use

Make sure the transaction is smooth and easy for your customer, you want to make it easy so that your customer come back for more.

Here’s a great eCommerce guide from my site at:

http://withinweb.com/global/hints_tips_and_tricks/digital_files.pdf

on further concepts for digital downloads.

The product PHP-eSeller is designed to sell digital goods from your web site using a PHP shopping cart system.  PHP-eSeller has a number of carts, and displays which enable you to integrate it to an existing site.

  Click here to go to PHP-eSeller description  

Setting up email for use with PHP applications

If your web application requires emails to be sent out from your web server for such things as sending download information, login information and so on, then you will need to set up some email accounts on your hosting system. This is particularly true for an application such as PHP-eSeller where it is important for the emails to be sent out correctly and reach their destination without ending up in the spam folder.

Log into your hosting account where you set up your databases and administer your web hosting. Normally this will be using cpanel which will look something like this:

You should see a section identified as “Mail”.

You need to set up an email account, so click on the link for “Email accounts” which will take you to a display where you create an account with a user name and password for your domain.

Enter in an email account name. For my applications I normally create an admin account so this will become admin@myservername.com. You also need to enter in a password which you should should keep a record of.

Now that you have created your account, your hosting will provide you with a link to a web mail client where you can login and then see your emails. You may want to send a test email to your account from hotmail or yahoo just to see how it works.

Now that you have an email account set up, you can use this in your PHP applications.

There is one other step that you may want to do, and that is to redirect this email to one of your other accounts. This will mean that when someone emails admin@yourservername.com, it will appear in your hotmail or yahoo account.

To do this, in cpanel under the “Mail” section, click on the link called “Forwarders”. Click on the button called “Add Forwarders” which will take you a page that will look something like:

Update to PayPal IPN

In Sept 2016 PayPal are changing their requirement for posting IPN messages back to PayPal for verification.

They are making the post url as https. My current versions of scripts already post to https so there should not be any change required, however, they also suggest that https://ipnpb.paypal.com/cgi-bin/webscr should be used in the future rather than https://www.paypal.com/cgi-bin/websc

Change:

https://www.paypal.com/cgi-bin/webscr

to

https://ipnpb.paypal.com/cgi-bin/webscr

PayPal upgrade to Certificate which may affect IPN based programs and scripts

There appears to be quite a bit of chat about the changes that PayPal are making to their system to allow SHA-256 during September 2015. This is to do with improving the SSL (Secure Socket Layer) security and is used over https systems.

A part of their message is:

“PayPal is upgrading the certificate for www.paypal.com to SHA-256. This endpoint is also used by merchants using the Instant Payment Notification (IPN) product.”

PayPal IPN can be used over non SSL, that is using http – that is why many developers like it because it does not need SSL certificates on their web servers which can be expensive especially if you are a small trader. You don’t really want to have to purchase certificates if you are selling a small number of items.

So the kind of systems that are affected are those that use https and which use PayPal API to provide secure connections from your server to the PayPal server.

IPN over plain http will be supported as it currently is, so you will still be able to supply a plain http link to your IPN listener script. However if your IPN listener script is sSL/TLS enabled it will have to be SHA-256 complaint and your listening server will need to be able to accept SHA-256 certificates.

So do the changes affect the scripts on www.Withinweb.com that use IPN? Well the answer to that is NO, it does not affect the scripts at all.

PHP-eSeller, PHP-SecureArea and PHP-KeyCodes use a simple method of handshake between PayPal to verify that the transaction has taken place and hence no modifications are need to the applications.