Purchasing a digital item
The basic operation is that when a customer purchases an item, a unique download link
is added to tblusers.
At the same time the application looks up the files that are applicable for
this item using the tables tblitems and tblfiles.
Once the files have been identified, tbldownloads is updated with the user,
files, number of download retires and expiry date.
When the customer goes to the download page, the files are looked up using
tblusers and tbldownloads and the user is presented with a list of buttons
for the files he purchased.
Should the same customer make another purchase, he will be given another link,
but can use either link. The customer will
then be presented with a list of files applicable for both purchased items.
Purchasing of an item is controlled by the PayPal IPN system. Only when the
confirmed message is received from PayPal will the application process the
purchase. There are a number of checks within the application to prevent attempts
to spoof a purchase. These include checking the purchased price and currency,
and checking the PayPal transaction id to make sure that it has not be used
before.
As the customer downloads an item, the number of allowed downloads is reduced.
Physical items have simpler processing because there are no downloads associated with
the physical items. If digital and physical items are added to a cart, the system is able
to handle the different processing and hence customers are able to purchase both physical
and digital goods at the same time.