Forums / General Questions / Selling software licences

Selling software licences

Results 1 to 20 of 131
22 May 2006, 15:56
#1
more_solutions avatar

more_solutions

New Zenner

Join Date:
May 2006
Posts:
23
Plugin Contributions:
0

Selling software licences

Is there a way within Zen to sell software licences?

eg: I have a list of (say) 10 licences for product X. I should be able to put product X into ZC with a stock level of 10, and each purchase would allow the buyer to download their (unique) licence. Obviously two purchasers would not get the same licence.

I can't see anything relevant but then my searching skills might just be no good!

If I can't do this, hints as to where to start writing a module to do it appreciated.
22 May 2006, 17:27
#2
absolute avatar

absolute

Totally Zenned

Join Date:
May 2005
Posts:
1,054
Plugin Contributions:
2

Re: Selling software licences

Hi,

I ahve to say that I haven't seen this modification in my travels, however, its fairly easy to add if you know a little php.

I would suggest editting the order conformation email, and the My Account pages if I were you.

You will need to add a new table to your database, and call it something like software_codes. Then create columns for code_id, product_id, date_added, customer_id, software_code. Thats all I can think of, but you may decide to add more.

Then all you need to do is add your code, with the products_id to the table, and ensure the customer_id column is an integer, with a default of 0.

Now you need to code the email. FInd the code which generates the order confiramtion email, which in 1.2.7 is in the orders class, under function send_order_email, and add a search & update sql command.

The sql will need to retrieve a random row, where customers_id = 0, and products_id = the product you just sold. Using the code id, then update this record with the customer id of the buyer for your records. You should now have the correct software key. Simply put this into the email, after the product description. Hay-presto, your done. You can then elaborate on this, buy adding this information to the customers account if you wish, but I'll leave the how and pointers for another day.

Hope this helps

Absolute B)
23 May 2006, 10:22
#3
more_solutions avatar

more_solutions

New Zenner

Join Date:
May 2006
Posts:
23
Plugin Contributions:
0

Re: Selling software licences

Absolute:

Hi,

I ahve to say that I haven't seen this modification in my travels, however, its fairly easy to add if you know a little php.


PHP knowledge isn't a problem for me, getting my head arounf how Zen is structured is - so thanks for your help.

[/QUOTE]
I would suggest editting the order conformation email, and the My Account pages if I were you. ...
[/QUOTE]

If I understand you correctly, then, I simply add product X as a normal product but add 10 licence codes to my new table. When anyone buys a new product I pick the next available licence for that product, and allocate it against that customer_id (and against that order as well, I think). I do all this from the order confirmation email. I also update the product stock level according to how many licences are now left.

I like the way you think! I'll have a crack at this.

You can then elaborate on this, buy adding this information to the customers account if you wish, but I'll leave the how and pointers for another day.


I'll come back when I get that far!

Is there any general interest in this mod?
23 May 2006, 13:04
#4
more_solutions avatar

more_solutions

New Zenner

Join Date:
May 2006
Posts:
23
Plugin Contributions:
0

Re: Selling software licences

more-solutions:


I'll come back when I get that far!


OK, so I have something basically working....

Where do I start when it comes to showing licences on the customers account page?

Also:
If I want to add licence admin into the admin system where do I start?

One problem I have discovered is that by putting the code into the email confirmation, the customer gets the licences before payment has been confirmed (if using offline payment, or COD, etc). This would also be a problem for any virtual products - is there a general solution?

PS: If anyone wants to try my hack let me know. I'll write it up when I get chance, but it'll happen sooner if someone asks for it!
25 May 2006, 10:29
#5
absolute avatar

absolute

Totally Zenned

Join Date:
May 2005
Posts:
1,054
Plugin Contributions:
2

Re: Selling software licences

In terms of admin settings for licence coding, I would create a new page, and have a simple add licence form. Then have a dropdown with the products in it, and a textbox for your licence code. Using this form, you can then use the product_id as the id for the selected application, and upload that to your new product_licence table. On the product licence page you could add a table to show you which keys are availabe, and a list of those taken and who bought them - you can make it as simple or complex as you like.

Next, the email after purchase issue - why not create a new email template with just the licence information in it? If your customer pays with onlince card, then send it immediately, otherwise add a link to the licences page or order page that send sthe licence when you have received payment.

Finally, the customers account page - i would suggest adding a check to see if payment has been received, and if it has, then on the order details, just add a popup or roll over that displays the key for the software.

Hope this helps

Absolute
29 Jun 2006, 12:21
#6
rstorob avatar

rstorob

New Zenner

Join Date:
May 2005
Posts:
5
Plugin Contributions:
0

Re: Selling software licences

Did you manage to achieve a good solution to this? Would be interested to see the end result. Rob
29 Jun 2006, 17:48
#7
more_solutions avatar

more_solutions

New Zenner

Join Date:
May 2006
Posts:
23
Plugin Contributions:
0

Re: Selling software licences

rstoROB:

Did you manage to achieve a good solution to this? Would be interested to see the end result. Rob


Depends which bit you're asking about.

I got something to send an email after "purchase" but since we currently process cards offline it means the code goes out before we actually get cleared payment, so its no use to us.

I didn't get as far as modifying it to work for offline payments because I intend to move towards online payments anyway.

So, if you need offline payments to work I can't currently help but if you want to take my code as a starting point you're welcome. If you're using online payments then my code should work, but hasn't been heavily tested and is without warranty!
11 Oct 2006, 22:49
#8
savage avatar

savage

New Zenner

Join Date:
May 2006
Posts:
28
Plugin Contributions:
0

Re: Selling software licences

This thread is pretty much exactly what I was looking for....

more-solutions:


So, if you need offline payments to work I can't currently help but if you want to take my code as a starting point you're welcome. If you're using online payments then my code should work, but hasn't been heavily tested and is without warranty!


I would be interested in seeing the code you have so far. So please let me know how I can get a hold of it and if you have made any progress since May.

My plan is to generate the licence key based on the customer's Email Address and product purchased. That way I won't have to keep entering licence keys for each new product I add. As long as the installation software uses the same key generation method it should install fine on their machine as long as they use the sme email address and the generated licence key. The Email Address and Product purchased combination should hopefully create a unique licence key and as such just require one extra column on the customer->orders table ( if there is one ).
So does anyone see anything wrong or a flaw with my plan?

I am surprised that ZC does not have a module that does this sort of thing already, only that the developer would have set a flag somewhere and modify the key generation algorithm. Maybe it should have a software downloads flag.
13 Oct 2006, 10:21
#9
absolute avatar

absolute

Totally Zenned

Join Date:
May 2005
Posts:
1,054
Plugin Contributions:
2

Re: Selling software licences

I only see 1 flaw in your plan, at first glance. Is your software in great demand? Is it something that I would buy, and then recommend to all my friends and family to use on their pc? If so, you have a little problem, in that I buy a copy, and download it. It asks me for my email address, and key. I enter it, and activate the product. I thengive the download to 100 of my mates, along with my email address, and the licence key you sent me.

One way around this is to create a completely separate table, with licence_id, order_product_id, licence_key, activation_date, and possibly mac_code, or unique_pc_id. You can then, when the order is created add the new licence code to the table. If your customer buys two copies, add 2 entries. Next, create a new db user, which allows read-only on the customers table, and read/write on the new licence table. All other tables MUST be restricted.

You can then use your software to communicate with your MySQL database on activation to find out if the licence key has already been used, and if it has, was it used on the same PC? If so, then this is just a re-install, rather than a new install, and should be allowed.

This is a simplified version of the method Symantec use for Norton and other software titles.

Good luck, and sorry to throw the spanner!

Absolute
13 Oct 2006, 13:39
#10
savage avatar

savage

New Zenner

Join Date:
May 2006
Posts:
28
Plugin Contributions:
0

Re: Selling software licences

Absolute:

I only see 1 flaw in your plan, at first glance. Is your software in great demand? Is it something that I would buy, and then recommend to all my friends and family to use on their pc? If so, you have a little problem, in that I buy a copy, and download it. It asks me for my email address, and key. I enter it, and activate the product. I then give the download to 100 of my mates, along with my email address, and the licence key you sent me.


But this scenario is really no different to what happens to a CDs or DVDs today, is it?

Absolute:


One way around this is to create a completely separate table, with licence_id, order_product_id, licence_key, activation_date, and possibly mac_code, or unique_pc_id. You can then, when the order is created add the new licence code to the table. If your customer buys two copies, add 2 entries. Next, create a new db user, which allows read-only on the customers table, and read/write on the new licence table. All other tables MUST be restricted.

You can then use your software to communicate with your MySQL database on activation to find out if the licence key has already been used, and if it has, was it used on the same PC? If so, then this is just a re-install, rather than a new install, and should be allowed.


This is great idea and something I will keep in mind. Does PHP keep track of the Mac_code/address?

The only thing is that I hate the fact that modern software forces you to be connected/online when installing. We will be selling PC/Linux/MacOS X and maybe even mobile games. I think for the time being I will just need to trust most users and that the games will be of good enough quality at a reasonably low price that they will not feel like ripping me and the game developers off.
Of course there will always be people that want everything for free, but I'm hoping that they are in the minority.

Thanks again for your feedback. Now all I need to do is find a licence key generating PHP file :D .
14 Oct 2006, 14:24
#11
more_solutions avatar

more_solutions

New Zenner

Join Date:
May 2006
Posts:
23
Plugin Contributions:
0

Re: Selling software licences

savage:


I would be interested in seeing the code you have so far. So please let me know how I can get a hold of it and if you have made any progress since May.


I'll post this here since others have also asked about it. Regarding Absolute's concerns: that is an issue with any licence scheme. In my case I needed to sell licence codes for third party applications, ie they took care of ensuring that the licence only got used once (they had to do this anyway: the licence was buying access to a service for a period of time, so even the purchaser would have re-used it if they could!)

Anyway, the instructions:

=== Selling licences with ZenCart ===

== Basic concept: ==
~- Add a new table to store licences
~- Buy a product that has licences. During the email confirmation stage update the required licenes to match the new order ID.
~- Add those details to the email
~- Update stock level.

== Comments ==
~- Not written a backend admin bit yet so for time being have to add licences manually to products_licences table
~- Instructions untested. I have done the changes and they work, but then wrote the docs. So the docs may miss something.
~- Email with licence(s) is sent with order confirmation. ''This is not good if payment hasn't been confirmed yet!'' OK for auto CC processing, not good with manual CC processing.

== Details: ==
Create a new table:

CREATE TABLE `products_licences` (
  `licences_id` int(10) unsigned NOT NULL auto_increment,
  `products_id` int(10) unsigned NOT NULL default '0',
  `products_attributes_id` int(10) unsigned default NULL,
  `licences_code` varchar(250) NOT NULL default '',
  `orders_id` int(10) unsigned default NULL,
  PRIMARY KEY  (`licences_id`),
  KEY `product_id` (`products_id`,`orders_id`),
  KEY `product_attributs_id` (`products_attributes_id`)
) TYPE=MyISAM;

Add the code to includes/classes/order.php, function send_order_email():
Was:
[PHP]
function send_order_email($zf_insert_id, $zf_mode) {
global $currencies, $order_totals;
[/PHP]
Now:
[PHP]
function send_order_email($zf_insert_id, $zf_mode) {
global $currencies, $order_totals, $db;

// START: MSL - Licences Mod
$licences = array();
//$db->Execute('UPDATE products_licences SET orders_id=NULL'); // DEBUG!!!
$this->licences_html = $this->licences_text = '';
for ($i=0, $n=sizeof($this->products); $i<$n; $i++) {
$db->Execute('UPDATE products_licences SET orders_id='.$zf_insert_id
. ' WHERE products_id='.$this->products[$i]['id']
. ' AND orders_id IS NULL'
. ' LIMIT '.$this->products[$i]['qty']
);
$dbres = $db->Execute('SELECT licences_code FROM products_licences'
. ' WHERE products_id='.$this->products[$i]['id']
. ' AND orders_id='.$zf_insert_id
);
while(!$dbres->EOF) {
$this->licences_html .= '<p>'.$this->products[$i]['name'].':<br><span class=licences_code>'.$dbres->fields['licences_code'].'</span></p>';
$this->licences_text .= $this->products[$i]['name'].":\n".$dbres->fields['licences_code']."\n\n";
$licences[$this->products[$i]['id']][] = $dbres->fields['licences_code'];
$dbres->MoveNext();
}
// Update licences stock level
$dbres = $db->Execute('SELECT count(*) AS count FROM products_licences'
. ' WHERE products_id='.$this->products[$i]['id'].' AND orders_id IS NULL'
);
$db->Execute('UPDATE products SET products_quantity='.$dbres->fields['count'].' WHERE products_id='.$this->products[$i]['id']);
}
// END: MSL - Licences Mod
[/PHP]

Was:
[PHP]
//products area
$email_order .= EMAIL_TEXT_PRODUCTS . "\n" .
EMAIL_SEPARATOR . "\n" .
$this->products_ordered .
EMAIL_SEPARATOR . "\n";
$html_msg['PRODUCTS_TITLE'] = EMAIL_TEXT_PRODUCTS;
$html_msg['PRODUCTS_DETAIL']='<table class="product-details" border="0" width="100%" cellspacing="0" cellpadding="2">' . $this->products_ordered_html . '</table>';
[/PHP]

Now:
[PHP]
//products area
$email_order .= EMAIL_TEXT_PRODUCTS . "\n" .
EMAIL_SEPARATOR . "\n" .
$this->products_ordered .
EMAIL_SEPARATOR . "\n";
$html_msg['PRODUCTS_TITLE'] = EMAIL_TEXT_PRODUCTS;
$html_msg['PRODUCTS_DETAIL']='<table class="product-details" border="0" width="100%" cellspacing="0" cellpadding="2">' . $this->products_ordered_html . '</table>';

// START: MSL - Licences Mod
// Licences Area
if ($this->licences_html) {
$html_msg['PRODUCTS_LICENCES']='<table class="product-details" border="0" width="100%" cellspacing="0" cellpadding="2"><tr><td>' . $this->licences_html . '</td></tr></table>';
$email_order .=
$this->licences_text .
EMAIL_SEPARATOR . "\n";
}
// END: MSL - Licences Mod
[/PHP]

== Modify the email template, email/email_template_checkout.html
Was:
.copyright {border-bottom:0px solid #9a9a9a; padding:5px;}
</style>


Now:
.copyright {border-bottom:0px solid #9a9a9a; padding:5px;}
.order-licences-area{background-color:#DDDDAA; border:2px #9a9a9a; width:542px; padding:2px; font-size:10px; }
.licences_code{font-weight: bold; font-size: 12px; font-family: monospace;}
</style>


Was:
	<div class="order-detail-area">$ORDER_TOTALS</div>

	<div class="comments">$ORDER_COMMENTS</div>

Now:
	<div class="order-detail-area">$ORDER_TOTALS</div>
	<div class="order-licences-area">$PRODUCTS_LICENCES</div>

	<div class="comments">$ORDER_COMMENTS</div>
14 Oct 2006, 16:38
#12
savage avatar

savage

New Zenner

Join Date:
May 2006
Posts:
28
Plugin Contributions:
0

Re: Selling software licences

Hi more-solutions,
Thanks for sharing your code. It's greatly appreciated.
02 Dec 2006, 20:03
#13
neunetllc_com avatar

neunetllc_com

Banned

Join Date:
Oct 2006
Posts:
113
Plugin Contributions:
0

Re: Selling software licences

savage, what mobile os did you want to enable direct downloads to?

did you still need a key generator? here's a helpful hint if you want give it a go yourself: the function mapping has to be a one-to-one onto function.

depending on how important your software is, you can make your domain-range scale quite large and the random seed more or less random. for example, intel has an rng that uses cpu thermal noise, which is truly random, unlike a lot of other software generated rngs.

aside: i suggest using wikipedia if you need a math primer. i actually found some very useful information on the relationship between a family of statistical functions and sigmoidal neural network transfer functions there, something i didn't find elsewhere.
27 Jan 2007, 00:33
#14
lord_vyper avatar

lord_vyper

New Zenner

Join Date:
May 2006
Posts:
4
Plugin Contributions:
0

Re: Selling software licences

Has anyone developed a admin mod for this?

This is perfect for what one of my customers needs, but having to add keys via phpMyAdmin is a bit cumbersome.
11 Feb 2007, 16:18
#15
eaglewu avatar

eaglewu

New Zenner

Join Date:
Jan 2007
Posts:
82
Plugin Contributions:
0

Re: Selling software licences

Lord_Vyper:

Has anyone developed a admin mod for this?

This is perfect for what one of my customers needs, but having to add keys via phpMyAdmin is a bit cumbersome.


I also want the admin mod. Can someone help?

Thanks in advanced.

What if I sell different types of licence keys? Does this also work?
12 Feb 2007, 12:51
#16
moktar avatar

moktar

New Zenner

Join Date:
Jan 2007
Posts:
17
Plugin Contributions:
0

Re: Selling software licences

Hello,

Lord_Vyper:

Has anyone developed a admin mod for this?


eaglewu:

I also want the admin mod. Can someone help?


I made such a mod for one of my sites. It is based on the same technique and also lacks the the admin part to manage licences (you have to use PhpMyAdmin to add licences). The licence attribution is manual, right now (just one click from the orders page, once the payment is validated), but I could probably easily integrate it with automatic payment confirmations such as PayPal.

However, my mod is not ready for public release as it needs some cleanup and more functions for non-techies admins.

I don't have much time to work on it right now, but I might consider it later if there are people willing to support its development by a donation. If you are, feel free to contact me by private message (I don't want to hijack this thread).
16 Feb 2007, 21:22
#17
djsmyers avatar

djsmyers

New Zenner

Join Date:
Dec 2006
Posts:
39
Plugin Contributions:
0

Re: Selling software licences

For those who are having difficulty with the manual adds for the keys, have you considered using a GUID algorithum? This will allow you to generate the key on the fly (you could also add that key to the table at that time). A really neat GUID class can be found on PHP Classes site (http://www.phpclasses.org/browse/package/1738.html). I haven't done the math, (and I don't plan on it either) but the chances of having two keys the same are very slim. Check it out, it's a good starting place.
02 Mar 2007, 13:50
#18
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Posts:
10,324
Plugin Contributions:
0

Re: Selling software licences

We're looking at integrating the software download with third party authorisation/licensing. Here the idea:

1. Shopper orders downloadable software from our zencart store.
2. using curent zen configurations, point shopper to download file only when payment has gone through (so it's manual intervention at this stage).
3. Shopper downloads software.
4. Shopper installs software on his/her machine
5. Activation popup asks shopper to link to remote authorisation server - and we're looking at MIRAGE for this purpose (mirage-systems.de) using their HOSTED authorisation option.
6. Remote authorisation server generates authorisation code.
7. Shopper enters code and activates software.

Only challenge is... how do we supply each new shopper with a unique serial numbered software download. (The remote authorisation server will ask the shopper for the unique serial number of their software. It then looks up this serial number. If the number's unused, it generates an authorisation key. if there's a key already allocated to that serial number, it reject the application).

So... we need matching serial numbers on the individual software downloads as are listed on the remote activation server.

Looking at the above thread, it seems possible to "embed" a serial number in the order confirmation e-mail (or at least the "your download is now available" e-mail.)

Any ideas on how we could look at integrating this feature?

PS. I know zip about php !!!
20 Mar 2007, 07:58
#19
eaglewu avatar

eaglewu

New Zenner

Join Date:
Jan 2007
Posts:
82
Plugin Contributions:
0

Re: Selling software licences

Does the update the stock part need change?
It seems also change the stock of product that is not in the product_licences.

BTW, I am still looking for the admin part.
20 Jun 2007, 16:52
#20
gamecardsdirect avatar

gamecardsdirect

New Zenner

Join Date:
Jun 2007
Posts:
3
Plugin Contributions:
0

Re: Selling software licences

Hi,

Any news on this topic / instant code notification? I too am in the business of selling codes (although I sell pre-paid game cards and game keys) and have been deperately searching for a module / work-around to solve this problem but have found nothing (although quite a few people like myself looking for one).

Best regards,

GameCardsDirect