Take a tour

Last updated: July 4, 2017 By HANNANSoft

Introduction

Gravity Forms License Manager is a Gravityforms add-ons that allows you to sell Game License, itunes card, phone card, serial codes, License keys, Antivirus Keys, PIN or license your digital product such as Plugins and themes. This plugin is your ultimate solution to sell licenses on your site via Gravity Forms.

Features

  • 1. Add unlimited Licenses and unlimited License Keys for each form. (How to Add License Keys? see below)
  • 2. Ability to use conditional logic for each License feed.
  • 3. Bulk Action (Add, Delete, Make Available, Make Unavailable).
  • 4. Prevents to buy and show custom message if Licenses are Unavailable.
  • 5. Supports Up to 4 custom field for each license. For example your License can have "License", "Pin", "Exipry date", "etc"
  • 6. Add custom "Prefix" and "Suffix" to each License key. (Supports merge tags)
  • 7. You can select that lisense keys will be delivered Only after Successful Payments or no.
  • 8. You can set expiry date as "Predefined dates" or "day numbers" after purchase.
  • 9. You can set and change License status as "null, Active, Inactive, Pending, Expired, Suspend, ...". aslo you can add another statues via add_filter function.
  • 10. Deliver License keys in "Confirmations" and "Notifications" or (SMS) via "Licenses Merge Tags"
  • 11. Advance Tracking System. (see blow)
  • 12. Encrypts License Keys before storing in Database via "GFCommon::encrypt()". Also you can override you custom "encryption and decryption PHP function".
  • 13. Automaticly Previews License keys as Image or QR-Code if key is a image URL.
  • 14. It is possible to deliver multiple license keys at a time by setting the "Quantity" in the feed configuration via gravity form formula!
  • 15. Advanced API System (is it Awesome?)
  • 16. Documentation

Requirements

First of all, you gotta to be sure all these requirements are OK.

  • PHP >= 5.3
  • WordPress >= 4.0
  • Gravity forms >= 1.9.20

Download

For downloading Gravity License Manager first Register in Codecanyon.net and buy this plugin from my portfolio page.

Buy Gravity Forms License Manager

Installation

  1. Install and activate Gravityforms from "WP-Admin >> Plugins" page in Wordpress Admin panel.
  2. Install this plugin and activate Gravityforms License Manager from "WP-Admin >> Plugins" page in Wordpress Admin panel.

Plugin Main Settings

After Installation, first you must go to "WP-Admin >> Forms >> Settings" and choose 'License' from existing tab.

API Token

With this API, you can find out about the status of the sold licenses outside WordPress and in your software programs. Set an custom API key if you want to use the Webservice. The full API documentation is also presented below.

Encrypt Mode

Imagine you will upload your Licenses via Manual ways. the Licenses will store in database and when one person goes to phpmyadmin or etc, he can see all licenses. but to prevent this event, you can encrypt the licenses before storing to database. if you want to encrypt them, you must select "Gravity Forms Encryption" or "Custom Encryption".

NOTE: Please select "Encrypt Mode" ONCE FOR EVER. Because changing it after selling Licenses will be dangoures.

  • "Gravity Forms Encryption" Encrypts License Keys via "GFCommon::encrypt()"
  • for "Custom Encryption" you must hook your encryption and decryption PHP functions to "ghlcm_encrypt" and "ghlcm_decrypt" filters. see example:
<?php
add_filter('ghlcm_encrypt', 'my_custom_ghlcm_encrypt', 10, 2);
function my_custom_ghlcm_encrypt($text, $lcm_obj) {
    //do some things on $text and encrypt it
    return $text;
}

add_filter('ghlcm_decrypt', 'my_custom_ghlcm_decrypt', 10, 2);
function my_custom_ghlcm_decrypt($text, $lcm_obj) {
    //do some things on $text and decrypt it
    return $text;
}
?>

Configuring feeds

for configuration your License feeds you must go to Gravity Forms >> Forms and select your Intended form and and choose 'License' from "Settings" submenu and click "Add New" button.

  1. Add unlimited Licenses and unlimited License Keys for each form.
  2. Ability to use conditional logic for each License feed
  3. Bulk Action (Add, Delete, Make Available, Make Unavailable)
  4. Supports Up to 4 custom field for each license. For example your License can have "License", "Pin", "Exipry date", "etc"

Inserting Licenses

You can add your license key in several ways:

1. Predefined Manual via Hand (One by One) or Batch Upload (.txt or csv)

You can set your custom "licenses seperator" and "key seperator".

Also you can put image url in 4 fields and it Automaticly Previews License keys as Image.

License Reserve time: In the event that a buyer submits a manual licenses, it will be impossible to buy the reserved licenses until a limited period of time. This period can be set via this field as Minute. If it expires and the user is unable to provide the license due to non-payment or any other reason, the licenses will be possible to be registered by other users.


2. Generate Automatically via Gravtiy forms Input Mask

Usage

  • Use a '9' to indicate a numerical character.
  • Use a lower case 'a' to indicate an alphabetical character.
  • Use an asterisk '*' to indicate any alphanumeric character.
  • All other characters are literal values and will be displayed automatically.
Examples
  • Social Security Number
    Mask: 999-99-9999
    Output Format: 987-65-4329
  • Course Code
    Mask: aaa 999
    Output Format: BIO 101
  • License Key
    Mask: ***-***-***
    Output Format: a9a-f0c-28Q

3. Using Rest-API (POST or GET) to deliver License Key from another Web Apps and third-party. (Yesss)

Other Options

In below you can see a screenshot of other options:

"Prefix" and "Suffix"

As you can see, you can put "Prefix" and "Suffix" for all 4 custom fields. this Prefix and Suffix are advanced and support "Gravityforms Merge Tags". as you know it will be very Useful. This phrase will add to before or after each licenses.


Unavailable License Error

You can Show a message when licenses are unavailable and prevent it from submitting.


Delivery Status

You can select that lisense keys will be delivered Only after Successful Payments or no.
Notice: Your Payment gateway must be standard and it is required to use "gform_post_payment_status" action via Gateways.


Initial license status

You can set Initial License status as "null, Active, Inactive, Pending, Expired, Suspend, ...". It represents the status of the license immediately after purchase, and you can change the status by editing the entry or API.


Quantity of Licenses

It follows the mechanism of Gravity Forms Calculations field. Specify a mathematical formula. The result of this formula will be dynamically populated as the value for Quantity of Licenses.
This field is VERY VERY IMPORTANT because it determines the number of requested licenses. for example if it returns 5, you must deliver 5 licenses to users.
Also, Pay attention if the condition of fields wasn't met, the merge tag of that fields returns 0 and its good.

Expiry Date

You can select one of the four fields as expiry date on "Date field" in feed page.
There is a "Date Format" input in feed configuration. you must fill it as you entered expiry dates. for example:
Imagine you considered "Field 4" as "Expiry date" and you entered your expiry dates such as "17.05.22 or 18.07.01 or 18.11.23", so you must fill "Date Format" as "y.m.d"
Date format follows PHP Formats.
Expiry dates can be useful if you want to use API in other applications.

Make Expiry Date base on "The number of days after purchase"

If you want to set the expiry date base on "the number of days after purchase date", leave "Date Format" BLANK. for expamle: Imagine you considered "Field 4" as "Expiry date" and you entered your expiry dates such as "30 or 60 or 90 or 100 , ....", so you must leave "Date Format" BLANK.

Make Dynamic Expiry Date

If you want to make expiry date Dynamic, it is very easy. you must do following tutorial:

  1. Select one of the four fields as expiry date on "Date field" in feed page.
  2. Leave all expiry dates blank. (in each Manual, Mask and Rest).
  3. Put your merge tag in "Prefix of Expiry Date".
  4. Leave "Suffix of Expiry Date" Blank.
  5. Configure "Date Format" base on your Prefix.

Delivering Licenses

You can deliver Licenses to users via "Merge Tags". when you install gravity license manager, new merge tags will add to merge tags list and you can use them in "Confirmations" and "Notifications" or (SMS) and etc.

"Licenses-Table" merge tag shows licenses as a table. but "Licenses-Simple" merge tag shows licenses as a simple text. you can see a tabled-license merge tag:

Tracking Sold Licenses

  • 1. Licenses will show in Entry details. also you can edit them.
  • 2. Licenses can be track via API.

API documentation

With this API, you can find out about the status of the sold licenses outside WordPress and in your software programs. API is safe because you must set your custom API_Token in Plugin settings.
This plugin is very useful for creating a license server and doing the following via JSON API:

  • Deliver License Key from another Web Apps and third-party to users after purchase.
  • Inquiry stocks before deliver what said above line.
  • Check the expiry date and status like "Active, Inactive, Pending, Expired, Suspend, ..." of a license key from your application.
  • Change the expiry date and status like "Active, Inactive, Pending, Expired, Suspend, ..." of a license key from your application.

Set an API key to use the Webservice as the following document and Replace "http://YourWP.com" with your wordpress site URL.

Get License Keys Status and Expiry date via API.
URL http://YourWP.com/wp-json/lcm/v1/check
Input Parameters token :Required
key :Required

key can be one of key1 to key4. token is an API Token that you defined above.

Methods GET, POST
Output

if you have an error you must have a "message" property after json_decode.
"message" shows error response. see below example:

http://YourWP.com/wp-json/lcm/v1/check?token=inCorrectAPIKey&key=LPu8t-bCOss-O60oW
{
    "code":"rest_lcm_error",
    "message":"Entered Token is incorrect!",
    "data":{
        "status":403,
        "params":["token"]
    }
}

Else if you don't have any errors you must have "status_name" and "expires" property after json_decode.
"status_name" shows License status and it is in (null,pending, active, inactive, suspend, expired).
"expires" shows a date that License will be expired on this date.
the date format of "expires" is "Y/m/d". see below example:

http://YourWP.com/wp-json/lcm/v1/check?token=correctAPI&key=J0BOH-7hgLh-p2luI
{
    "expires":"2019\/07\/20",
    "status_name":"active",
    "Key1":"938920660602",
    "Key2":"J0BOH-7hgLh-p2luI",
    "Key3":"mX5cG-uNNvc-WRCu4",
    "Key4":"2017\/07\/20"
    "entry_details":{...}
}

"Key1 to Key4" can change base on your feed configuration.
"entry_details" shows details of entry such as field values and other details.


if you got NULL after json_decode, maybe your WORDPRESS has a PHP error. check debug or error-logs.
Update License Keys Status and Expiry date via API.
URL http://YourWP.com/wp-json/lcm/v1/update
Input Parameters token :Required
key :Required
expires :Optional
status_name :Optional

At least One of the "Optional" parameters is required.

key can be one of key1 to key4. token is an API Token that you defined above.

the date format of "expires" must be "Y/m/d".

"status_name" must be in (null,pending, active, inactive, suspend, expired).

Also you can change "key1" to "key4" via API. in order to; you can send "key1" to "key4" as an Optional Paramters.

Methods GET, POST
Output

if you have an error you must have a "message" property after json_decode.
"message" shows error response. see below example:

http://YourWP.com/wp-json/lcm/v1/update?token=inCorrectAPIKey&key=LPu8t-bCOss-O60oW&expires=2019/01/05&status_name=custom
{
    "code":"rest_lcm_error",
    "message":"status_name must be in (null,pending, active, inactive, suspend, expired).",
    "data":{
        "status":400,
        "params":["status_name"]
    }
}

Else if you don't have any errors you must get below response:

http://YourWP.com/wp-json/lcm/v1/update?token=correctAPI&key=J0BOH-7hgLh-p2luI&expires=2019/01/05&status_name=active
or:
http://YourWP.com/wp-json/lcm/v1/update?token=correctAPI&key=J0BOH-7hgLh-p2luI&expires=2019/01/05&status_name=active&key1=IGRw-pzzy6&key2=7CG-TeQ6Wl-jxd
{"result":"success"}

if you got NULL after json_decode, maybe your WORDPRESS has a PHP error. check debug or error-logs.
Deliver License Key from another Web Apps and third-party to users after purchase.

OR Inquiry stocks before deliver what said above line.
Click Here

Final Sentences

Thanks to following persons for their cooperation.

  • God
  • My Family
  • Rocketgenius, Inc.
  • Envato.com
  • You

Once again, thank you so much for purchasing this plugin. I'd be glad to help you if you have any questions relating to this plugin. No guarantees, but I'll do my best to assist. If you have a more general question relating to the plugins on CodeCanyon, you might consider visiting the forums and asking your question in the "Item Discussion" section.