This is a good question, but I think you shouldn't limit the download of your app.
Why you shouldn't limit the download of your app
The reason you shouldn't limit the download of your app is that if you do you'll increase the amount of stolen credit cards being used to purchase your program. Thieves will be thieves. Limiting your app to "paying" customers won't stop a thief from buying 5000 stolen credit cards for $10 and running through the list until they get one that works.
If you have the download readily available then it will be fly paper for the thieves; they'll try to steal your app through normal reverse engineering means. You'll get less orders from stolen credit cards, thus you'll save money on the inevitable chargebacks once the victim realized they've had their credit card number stolen. Plus, hiding your software behind a private link is a hassle for legit users. Don't piss off your customers.
If you're keeping the download link private for renewal purposes (e.g. they can only update for a year), then you're better off solving this with licensing. The way you can do it in LimeLM is by using custom license features -- we have a full example that shows how to limit updates via licensing.
How to deliver product keys to your users
Delivering the product to your user (whether a download location or a product key) is dependent on a couple of factors:
- The licensing you use
- The payment platform you use
Most payment providers have ways of calling a script on your website to let you know a sale has been made. For example, using PayPal's IPN (Instant Payment Notification) can call a script on your website and from that script you can generate a serial then send your new customer an email with the product download site and serial number.
We actually have a full PayPal payment example written for PHP and ASP.NET (C# and VB.NET) that automates the entire process. It uses the PayPal IPN alongside our LimeLM web API to process the order, generate the product key on the fly, then email the user. So a user can start using the fully registered version of your software seconds after their order is processed.
If you update your question with the payment platform you use then we can point you to the right API or example code to use.
Lastly, if you're determined to keep your installer to customers only (even despite my advice not to), then you can do it with a simple script. Just pass the new customer's product key as a parameter to a script. For example: http://example.com/latest-installer.php?pkey=ABCD-EFGH-IJKL-MNOP-QRSTU
Here's an ASP.NET C# snippet of what the script would look like:
//TODO: verify the product key is valid, if not show an error and bail out
//if the pkey is valid, deliver the latest installer:
Response.Clear();
// download the file and bail
Response.AddHeader("Content-Description", "File Transfer");
Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", "attachment; filename=" + Path.GetFileName(installerFile));
Response.AddHeader("Content-Transfer-Encoding", "binary");
Response.AddHeader("Expires", "0");
Response.AddHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0");
Response.AddHeader("Pragma", "public");
Response.AddHeader("Content-Length", new FileInfo(installerFile).Length.ToString());
// output the file
Response.WriteFile(installerFile);
Response.End();
Here's what the same snippet would look like in PHP:
//TODO: verify the product key is valid, if not show an error and bail out
//if the pkey is valid, deliver the latest installer:
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.$installerFilename.';');
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($installerFullPath));
ob_clean();
flush();
readfile($installerFullPath);
exit;