Hi there,
Having been through the process myself, I thought it may be useful for others to have a guide as to how to distribute Win32 builds themselves, including using license keys. I chose to go with Gumroad (https://gumroad.com) because they allow you to tap into their system to check license keys against purchases and they were also super-helpful when I contacted them.
STEP 1:
Build for Win32 (this must be done using Corona on a Windows machine, not a Mac) and then create an .msi file of your app. I did this by using http://www.advancedinstaller.com (tutorial on how to create a basic msi from your .exe file here: http://www.advancedinstaller.com/user-guide/tutorial-simple.html))
STEP 2:
Sign up for a Gumroad account at https://gumroad.com, set up a new product (including uploading your Win32 build as an .msi file) and activate license keys for your product. When a user purchases a copy of your product via Gumroad, they will be given a unique license key. You should also read this: https://help.gumroad.com/11165-Digging-Deeper/license-keys
STEP 3:
You need to adapt your app to allow users to enter a license key the first time they run it. The key is a 32 character hexadecimal string separated with dashes every 8 characters:
ABCDEF12-34567890-ABCDEF12-34567890
I went with 4 separate textfields in a simple popup that came up on first run.
STEP 4:
Your app then needs to check the license key the user has entered against the Gumroad servers to check it is valid. Code below…
local params = {}; local postContents = {}; postContents.product\_permalink = "ABCD"; -- This should be changed to your product permalink which you can find on the end of your product's URL on Gumroad. postContents.license\_key = key; -- This is the license key that the user has entered via whatever method you have developed postContents.increment\_uses\_count = "true"; -- This can be set to false if you don't want to update the number of installs registered with Gumroad (see below for more on this) local uploadContentsJson = json.encode (postContents); local headers = { ["Accept"] = "\*/\*", ["Accept-Charset"] = "\*", ["Content-Type"] = "application/json", ["Accept-Language"] = "en-US", ["User-Agent"] = "Your\_App\_Name", ["Accept-Encoding"] = "", } params.headers = headers; params.body = uploadContentsJson params.progress = "upload"; params.timeout = 20; local url = "https://api.gumroad.com/v2/licenses/verify"; -- Post local rId = network.request( url, "POST", sendLicenseKeyListener, params);
And the listener…
function sendLicenseKeyListener(e) local phase = e.phase; if (phase == "ended") then if ( e.isError ) then -- Error print("Error") else print(e.response); local d = json.decode( e.response ); local success = d.success; if success == true then local purchase = d.purchase; local uses = tonumber(d.uses); -- Do whatever you want to with this info -- Can also access purchase.refunded and purchase.chargebacked else -- Verification failed -- handle this gracefully end end end end
STEP 5:
If the license check was successful then ensure your code saves the license key the user entered into your app’s local database or somewhere else you can check it in the future if you want to, without having to ask them to enter it again.
STEP 6:
If on future launches of your app you do want to check that the license key the user entered that was then saved in step 5 is valid then you’ll need to run the above code but with one crucial change:
postContents.increment\_uses\_count = "true";
should become…
postContents.increment\_uses\_count = "false";
This way the number of installs logged with Gumroad won’t be increased every time your software runs.
STEP 7:
Once you’re happy that license keys are being entered and validated correctly, republish your app, recreate it as an .msi file and reupload it to Gumroad.
OPTIONAL:
Adding a digital certificate to your app is recommended so that users won’t experience the “Unknown Publisher” issues that may put them off installing. You can use Thawte or Verisign or Digicert (amongst others). There is a cost involved however (around $200 per year). I haven’t been through this part of the process yet but once I have I’ll post anything that may help.
Hope this helps someone. Any questions, just reply to this thread.
Thanks,
Ian