Clone wiki

satchmo / VirtualProducts

Virtual Products

Use cases

  • Selling music, images, themes, html/css design, ebooks (anything that can be downloaded as files or as streams).
  • One-time download.
  • Or access to the files during a given period.
  • Selling licenses for shareware.
  • Selling services (email/phone support, web/email hosting).
  • Email/phone support for 5 incidents
  • 20 hours phone support
  • 1 year hosting of with 1GB traffic/month and 20Mb of quota.
  • Requesting donations for a non-profit association (buy a brick for a new school in Uganda, etc.)


Various considerations

  • The expectation for each kind of virtual product is different. I expect that people will always want to be able to customize the behavior and appearance of their virtual products.
  • Thus the base class shouldn't contain too many data and shouldn't try to cover all cases. Instead it must define a common interface and "hook points" that will let people personalize their virtual products.
  • Among the few things that are common to all cases, I believe there's the idea of a "virtual good" resulting from the purchase. A virtual good usually has a (varying) life span. Thus I believe there must be a function telling us if the virtual good is still active/valid.
  • The user should be able to browse through its virtual goods. Thus virtual good must have an URL (it might be the same than the one of the product, or it might be a totally separate one like a direct pointer to a file or an intermediary page from where they can "benefit" from their good).
  • In some cases the digital good might generated/modified for each purchaser. A watermark might be added, or license metadata might be added, or some password set on it (as in a PDF), etc.
  • Ideally, the media must not be downloadable by non-purchasers even if they get a copy of an email sent to a purchaser. That is, there should be an option to require anyone downloading to be logged in, so that regardless of MD5 checksums or whatever, a user must give up their password. Of course, a user could still just download the media and then share it directly, so this doesn't provide real protection, but at least this way the sharing isn't mediated by our server.


Put your design ideas for virtual product support here.

  • Create a VirtualProduct model something like this (syntax is not 100% correct):
class VirtualProduct(models.Model):
     sub_item = models.ForeignKey(SubItem)
     num_allowed_downloads = models.IntegerField()
     num_hours_available = models.IntegerField()
class VirtualProductFile(models.Model):
     virtual_product = models.ForeignKey(VirtualProduct)
     description = models.CharField()
     download_file = models.FileField()

# What about VirtualGood for this one?
class PurchasedVirtualProduct(models.Model):
     virtual_product = models.ForeignKey(VirtualProduct)
     customer = models.ForeignKey(Contact)
     order = models.ForeginKey(Order)
     num_downloads = models.IntegerField()
     url_key = models.CharField()

This set of models would allow you to:

  • Associate a virtual product with each sub_item so that you can use the existing options to select a specific virtual product to be downloaded.
  • Set limits on the number of times it can be downloaded and/or the time it should be made available.

Files would have to be stored in a location that is not visible to a user surfing the site. This snippet could be used to send the file.

Here's a discussion on the Django group about generating and using MD-5 hash in a url Google Discussion

Here's possible solution when using lighttp -