How to generate product keys after an order
This article will show you how to generate product keys and send them to your users using the LimeLM web API. At the end of this tutorial you'll have a payment form that automates the entire order process.
Step 1. Signup for LimeLM, download the Web API pack
If you haven't already signed up for LimeLM then sign up now. All plans have a 30-day free trial. Or, if you're just putting your toes in the water, there's even a free plan that has no time limit and doesn't require a credit card.
After you've created your account download the LimeLM Web API pack. This zip file contains example code for PHP and ASP.NET (C# & VB.NET). If you're not using PHP, C#, or VB.NET, that's alright — we'll cover how to use the LimeLM web API with other languages in the tutorial.
Step 2: Create a product within LimeLM & add TurboActivate to your app
After you've signed up with LimeLM you'll need to create a product and add TurboActivate to your app. Read the "Getting started with LimeLM" article to learn how to do this.
Step 3. Getting your API key
Now that you've added a product within LimeLM and added TurboActivate to your app you're ready to make the payment form for your website. This payment form will be using to the LimeLM API to generate product keys so you'll need to copy your LimeLM API key from your settings page.
Step 4. Getting the Version ID
You can get the version ID by examining the URL in your browser. For instance, from the URL
http://wyday.com/limelm/version/100/ you can see the version ID is 100. (Note: The Version ID is not the Version GUID).
Step 5 (option 1). Using our pre-written examples (PHP, C#, or VB.NET)
If you're using PHP or ASP.NET then you can use our pre-written payment form included in the LimeLM Web API pack. After you've extracted the LimeLM Web API Pack you can find the ASP.NET payment form examples in the "CSharp" and "VB.NET" folders and the PHP example in the "PHP" folder.
There are 4 files that make up the entire payment process:
payment.php (or payment.aspx) PaymentSettings.php (or PaymentSettings.cs, or PaymentSettings.vb) pay-thankyou.php (or pay-thankyou.aspx) paychecker.php (or paychecker.aspx)
This is the actual payment page where the user selects their payment method, enters their billing information, and enters the number of licenses they are buying. You won't need to change anything on this page other than the styling. All of the name, pricing, and payment options are configured in the PaymentSettings.php/.cs/.vb file.
PaymentSettings.php (or PaymentSettings.cs, or PaymentSettings.vb)
The PaymentSettings file contains every setting for the payment form. You can enable and disable payment methods by setting the following 4 variables:
UseAuthorizeNetCC(for Authorize.Net credit card processing)
UseAuthorizeNetBank(for Authorize.Net bank transfer processing)
UseMoneybookers(for Moneybookers orders)
UsePayPal(for PayPal orders)
This file also contains the
SendPKeys(quantity, email, first, last) function. This function generates a product key with "quantity" number of activations then emails it to the customer. This function is called from various places, depending on the payment methods you have enabled.
pay-thankyou.php (or pay-thankyou.aspx)
This is the page your users are redirected to after they've made a successful order.
paychecker.php (or paychecker.aspx)
If you've set either the
UseMoneybookers variables in PaymentSettings.php/.cs/.vb to "true", then this file will be used. In short, this script verifies the order is valid by checking with PayPal or Moneybookers, confirming the money was sent to the right place, and confirming amount paid was the correct amount.
Then, after the order has been verified, the
SendPKeys(...) function in the "PaymentSettings" file is called and generates a product key for the customer and emails it to them.
Step 5 (option 2). Use the LimeLM web API
If you're not using PHP, C#, or VB.NET, then you can still use the limelm.pkey.generate web API function to generate product keys from within your web app. If you don't want to write the code to generate product keys on the fly, then you can make bulk product keys, export them from LimeLM, and then import them into your payment service: