License Keys
Provide a license key to customers after a successful purchase. This can appear on the completion page, email receipt, or account management portal following a successful purchase.
Generate a License
- Navigate to the product’s details page. In the Fulfillments section, click Edit.
- Click + Add Fulfillment > Generate a License.
- Click Choose a Generator… to select the type of license generator.
- Click Next.
The following steps will vary depending on what type of license generator you selected.
Pre-Defined List
If you have an existing list of license keys, paste them in the Pre-Defined List field, and control the number of license keys per quantity purchased. Follow the instructions below to further customize the format and behavior of the pre-defined list.
-
Below License Format, select whether you want to limit each Licence Key to a single line. If a single key can contain carriage returns, select Multi-Line License.
-
Below License Quantity Behavior, select whether FastSpring issues a separate license key for each quantity purchased, or a single license key per purchase, regardless of the quantity.
- Below Step 2: Enter Licenses, enter a list of License Keys that follow the criteria you configured above.
- Click Create. The License Configuration dialog displays the number of licenses available based on what you entered in the editor.
Advanced Configuration
In the License List configuration page of each type of License Key, you can apply advanced configurations to customize your License Key.
- License Generator Name: Enter an internal-facing name for your license generator.
- Ordered List: Select this checkbox to ensure FastSpring issues the License Keys in the order in which you pasted them. If you do not select this checkbox, FastSpring may issue license keys from your list in any sequence.
- Custom Template Key: Enter an identifier to assign more than one license generator to the product. This enables you to separately identify them in a template, and use the identifier to control where the License Key is placed.
Script
You can supply a custom PHP script or JavaScript snippet for FastSpring to use when generating license keys. As you are applying changes, use the Test button at the top, right corner of the page to test your changes.
This is not a full implementation of PHP. Some features might be unavailable.
- In the Output Format drop-down, select the type of license key format that the script generates.
- Single-Line License (Quantity Based): One license key per quantity purchased. Separate license keys by a line feed character (or a carriage return + line feed character).
- Multi-Line License (Quantity Based): One license key per quantity purchased. Separate additional license keys with an empty line or a return + line feed carrier.
- Single License Only: One license key regardless of the quantity purchased by the customer. The license key may contain any type of character and may span multiple lines.
- Single File Based License / MIME 1.0: Binary data as a multipart/mixed MIME 1.0 file. Customers can download the file via a URL provided to them by FastSpring.
- In the License Name field, click the drop-down selector and select which data point from the order details the script factors into license key generation.
- Not Name Based: The license key generation does not take any name into consideration.
- Email Address: The script bases the license keys on the customer’s email address as entered during the purchase process.
- Person Name: The script bases the license keys on the customer’s full name as entered during the purchase process.
- In the Script Type drop-down, specify whether you are supplying a PHP script or a JavaScript snippet.
- Click Create. The General settings for your fulfillment are saved. You can edit the Output Format or License Name on the General page.
- In the Script Source Code, enter the custom License Key Generation Code.
- Save your changes.
The new fulfillment appears in the product details page.
PHP Script Parameters
- $name: The customer’s full name, company name, or email address, depending on License Name and the customer’s choice.
- $name_unicode: Array of Unicode codepoints (integers) representing name.
- $company:Customer’s company, if entered.
- $company_unicode:Array of Unicode codepoints (integers) representing a company.
- $email:Customer’s email address.
- $quantity:It is the responsibility of the script to determine how quantity is handled. If you return multiple licenses, all licenses will be assigned to the order.
- $product:The product name.
- $reference:The order reference.
- $subscription: The subscription ID.
- $tags: Map of tag names to tag quantities. Tag names are defined at the product level and allow license generation to be based on other products in an order. Tag values are always 1 or greater.
- $referrer: A custom value passed into the order process via the URL
JavaScript Parameters
The following lists the order parameters available for use in your JavaScript code.
- name: This may be the customer’s full name, company name, or email address, depending on License Name and the customer’s choice.
- company:Customer’s company, if entered.
- email:Customer’s email address.
- quantity:It is the responsibility of the script to determine how quantity is handled. If you return multiple licenses, all licenses will be assigned to the order.
- product: The product name.
- reference: The order’s reference / ID.
- subscription:The subscription reference / ID.
- tags: Map of tag names to tag quantities. Tag names are defined at the product level and allow license generation to be based on other products in an order. Tag values are always 1 or greater.
- referrer:A custom value passed into the order process via the URL.
Special JavaScript Functions
The following lists the special functions available for use in your JavaScript code.
- sha1HexDigest(arg1): arg1 is the String to produce the SHA1 hex digest for.
- md5HexDigest(arg1):arg1 is the String to produce the MD5 hex digest for.
- aes(arg1,arg2):arg1 is a 128 bit AES key in Base64. arg2 is the String to encrypt. Returns a Base64 String.
- aesDecrypt(arg1,arg2):arg1 is a 128 bit AES key in Base64. arg2 is the String to decrypt. Returns a Base64 String.
- dsaSign(arg1,arg2): arg1 is a 512 or 1024 byte DSA key in PEM format. arg2 is the String to sign. Returns a Base64 String.
- base64(arg1): arg1 is the String to convert to Base64. Returns a Base64 String.
- base64Decode(arg1):arg1 is the Base64-encoded String to decode. Returns a String.
- rsaSha512Sign(arg1, arg2): arg1 is the private key PEM, arg2 is the data to sign using SHA-512 with RSA. Returns the signature as a Base64 String.
httpGet(url, [params]) | var response = httpGet("[http://www.example.com](http://www.example.com/)", { "ipAddress": ipAddress } );response.statusCode;response.body; | |
httpPost(url, [params]) | var response = httpPost("[http://www.example.com](http://www.example.com/)", { "ipAddress": ipAddress } );response.statusCode;response.body; | |
`http({type:POST | GET, url: , username: , password:, params: {}})` | var response = http({type: "POST",url: "[http://www.example.com](http://www.example.com/)",username: "tom",password: "secret",params: { "ipAddress": ipAddress }});response.statusCode;response.body; |
Remote Server Request
Remote server request fulfillments contact a remote server to create a new, custom license key while FastSpring processes the order. After receiving the license key, FastSpring provides the customer with the license key and saves it as part of the order record.
- In the URL field, enter the URL or endpoint of your external server. FastSpring will access the URL during order processing to generate a license key.
- The URL must begin with http:// or https://.
- In the Method drop-down, select the POST or GET method for the HTTP request to your external server. We recommend using POST.
- If you selected POST, select the type of character encoding for the post body in the Post Encoding field below.
- This step does not apply for the GET method, as the URL includes the transaction data as URL parameters instead of transmitting the information as an HTTP message body.
- In the Output Format drop-down, select the type of license format that FastSpring should expect from the remote server.
- Single-Line License (Quantity Based): The script generates one license key per quantity purchased. License keys generated by the script may be separated by a line feed character (or a carriage return + line feed character).
- Multi-Line License (Quantity Based): The script generates one license key per quantity purchased. However, license keys may be separated by an empty line. The empty line separator should only contain a line feed character (or a carriage return + line feed character).
- Single License Only: The script generates one license key regardless of the quantity purchased by the customer. The license key may contain any type of character and may span multiple lines.
- Single File Based License / MIME 1.0: This advanced option supports binary data as a multipart/mixed MIME 1.0 file. Customers can download the file via a URL provided to them by FastSpring. See MIME 1.0 Output Format for more information.
- Click Create.
Access the Security, Parameters, and Advanced subpages to further customize the remote server request.
Security
Secure the License Key generation process and prevent fraudulent requests from being accepted by your server. Use the unique, 32-character private key to verify the authenticity of requests originating from your FastSpring Store.
In the Authentication section, enter a username and password. FastSpring passes the credentials specified here to the remote server with each license key generation request. You can configure the script to ignore requests that do not include a valid login.
Parameters
The Parameters subpage provides a list of order parameters that you can include in the URL. FastSpring passes these data points (such as transaction details or customer data) to the remote server for use in license key generation. You can customize up to 10 custom parameters on this page.
Advanced
Apply advanced configurations listed below to customize your license key.
- License Generator Name: Enter an internal-facing name for your license generator.
- Ordered List: Select this checkbox to ensure FastSpring issues the license keys in the order in which you entered them.
- Custom Template Key: Enter an identifier to assign more than one license generator to the product. This enables you to separately identify them in a template, and use the identifier to control where the license key is placed.
CocoaFob
Specify a DSA Private Key to generate license keys through CocoaFob. CocoaFob is an advanced option that may be beneficial for Mac or other Objective-C applications.
-
In the Product Name field, enter the name of the product. This becomes part of the registration source string.
-
In the DSA Private Key field, enter the private key used to generate licenses. The value you enter should begin with —–BEGIN DSA PRIVATE KEY—– and should end with —–END DSA PRIVATE KEY—–.
-
Click Create.
- In the License Source Template field, specify the license source template that your application will use to verify licenses.
- On the Advanced page, in the License Name field, click the drop-down and select which data point from the order details to factor into license key generation.
- Not Name Based: The license key generation does not take any name into consideration.
- Email Address: The implementation bases the license keys on the email address entered at checkout.
- Person Name: The implementation bases the license keys on the full name entered at checkout.
-
Optionally, select the Generate Multiple Licenses checkbox for FastSpring to generate a separate license key for each quantity purchased in the order. If you do not select this checkbox, FastSpring generates one license key per product, regardless of the quantity purchased.
-
In the Custom Template Key field, enter an identifier to assign more than one license generator to the product. This enables you to separately identify them in a template, and use the identifier to control where the License Key is placed.
-
Save your changes.
Aquatic Prime
Using AquaticPrime instructs FastSpring to generate a license file that is compatible with the third-party AquaticPrime algorithm.
For more information, see: https://github.com/bdrister/AquaticPrime.
- In the Product Name field, enter the name of the associated product. FastSpring will use this as the “product” key value in the license file.
- In the Full License Filename field, enter the name of the license you would like to provide to customers. Include the file extension.
- In the Public Key field, enter the public key for use in the license key generation.
- In the Private Key field, enter the private key for use in validating license files generated with the public key.
- Click Create. The Third Party Generator page appears.
- In the License Name field, select which data point the from the order to use in the #{name} variable when generating a license.
- Not Name Based: The #{name} variable is null.
- Email Address: The #{name} variable contains the customer’s email address.
- Person Name: The #{name} variable contains the customer’s full name, as entered at checkout.
- Optionally, use the MIME Type field to override the default AquaticPrime file MIME type.
- In the Content section, enter additional key/value pairs to include in the license output. Enter the key name in the Name column. In the Value column, enter the corresponding parameter to include in the license.
- Save your fulfillment.
Advanced Settings
- License Generator Name: Enter an internal-facing name for your license generator.
- Ordered List: Select this checkbox to ensure FastSpring issues the License Keys in the order in which you pasted them. If you do not select this checkbox, FastSpring may issue license keys from your list in any sequence.
- Custom Template Key: Enter an identifier to assign more than one license generator to the product. This enables you to separately identify them in a template, and use the identifier to control where the License Key is placed.
Software Passport
If you are already using Software Passport to protect your application, you can enter your Software Passport project settings in order for FastSpring to generate License Keys compatible with your project. Contact Support for more information.
- In the Encryption Template field, enter the encryption template from your Software Passport project for the current product.
- In the Signature Level field, click the drop-down and select the signature level used in your Software Passport project for the current product.
- In the Key Type / Version field, click the drop-down and select the key type and version used by your Software Passport project for the current product.
- Click Create. The General settings are saved, and an Advanced page becomes available.
Advanced
- In the License Name field, select which data point should be factored into license key generation via the name variable:
- Not Name Based: The license key generation does not take any name into consideration.
- Email Address: The implementation bases the license keys on the email address entered at checkout.
- Person Name: The implementation bases the license keys on the full name entered at checkout.
- In the License Name Modification field, indicate whether or not to modify the customer’s license name, based on your selection above.
- In the License Quantity Behavior field, select whether FastSpring issues a separate license key for each quantity purchased or a single license key per purchase, regardless of the quantity.
- Optionally, use the Custom Template Key field to enter an identifier to assign more than one license generator to the product. This enables you to separately identify them in a template, and use the identifier to control where the License Key is placed.
- Save your changes. The fulfillment appears in the Fulfillment section of the page.
Updated 11 months ago