Flex License - API Usage

About

This is the api documentation for the FlexLicense service.
All API verbs are GET, except /ipn_notification which is POST.
In case of success code 200 is returned along with a json content with at least informative msg field.
In case of error code class 400 is returned with a json content with msg field containing error message.


Paypal notification URL

Endpoint :
https://app.flexlicense.com/ipn_notification
This endpoint is the Paypal IPN callback to be set in your Paypal settings.
It will be called by Paypal for each transaction.
If the payment is recognized and confirmed a new license key will be attached to the client email with the given product credit and a verified status set to true.
An email with the license key will then be sent to the given client email.
You have to configure this endpoint in your Paypal account. Look Paypal help for this.

Billing will occur, see terms.


License status

Endpoint :
https://app.flexlicense.com/license-status
Your application or web site should call this endpoint to get license status in order to unlock selected features.

Product type must not be 'Custom'.
Query parameters :
  • apikey: one of the api keys given in the 'product' section of your account.
  • licensekey: the license key provided by the user in your application.
Returns:
A json object

{
    msg: string,
    balance: number,
    product: string,
    type: 'Time limited' | 'Inner credit' | 'Currency'
    unit: string,
    valid: boolean,
    verified: boolean,
    isTest: boolean,
    expires?: string 
}
  • msg: informative message about this api call.
  • balance: client balance given in 'unit'. If product is 'Time limited' balance is given in days allowed from first subscription.
  • product: name of your product.
  • type: type of your product.
  • unit: unit type of your product. If product is 'Time limited' unit will be 'days'.
  • valid: this is the most important field, it tells if your license is valid according to your product setting. If false, either date has expired, balance is negative or the account is not yet verified.
  • verified: tells if the user account is verified. Should be true.
  • isTest: tells that your product is in test mode and Paypal payment is in sandbox mode.
  • expires: if product type is 'Time limited' expires contains the expiry date.
Example
curl command:

curl -X GET \
"https://app.flexlicense.com/license-status?apikey=35766010-fe7f-4858-b7c3-d1e0a07cb4b8&licensekey=46624afe-726c-458c-bd30-88b99b801ba2"
or javascript code:

    const apiKey = '35766010-fe7f-4858-b7c3-d1e0a07cb4b8'
    const licenseKey = '46624afe-726c-458c-bd30-88b99b801ba2'
    const fetchUrl = `https://app.flexlicense.com/license-status?apikey=${apiKey}&licensekey=${licenseKey}`
    const response = await fetch(fetchUrl)
    if (response.ok) {
        const license = await response.json()
        if (license.valid) {
            //...
        }
    }
returns:

{
    "msg":"License status returned",
    "balance":90,
    "type":"Time limited",
    "unit":"days",
    "product":"Your Product",
    "valid":true,
    "verified": true,
    "isTest":false,
    "expires":"2022-10-05T13:46:46.959Z"
}


Withdraw client

Endpoint :
https://app.flexlicense.com/withdraw-client
Your application or web site will call this endpoint to withdraw some credit from your client account.

Product type must be 'Inner credit' or 'Currency'.
Query parameters :
  • apikey: one of the api keys given in the 'product' section of your account.
  • licensekey: the license key provided by the user in your application.
  • amount: amount to withdraw from your client account. If product type is 'Currency', rate, min charge and currency conversion will apply on this amount, according to your product settings.
  • currency?: optional currency ISO code, only used if product type is 'Currency'. If product type is 'Currency' default to your product type unit if not provided.
Returns:
A json object

{
    msg: string,
    product: string,
    unit: string,
    amount: number,
}
  • msg: informative message about this api call.
  • product: name of your product.
  • amount: amount debited.
  • unit: type unit debited.
Example
curl command:

curl -X GET \
    "https://app.flexlicense.com/withdraw-client?apikey=0843ec9c-5874-4904-9d5b-532c48516bdf&licensekey=e3c52ec3-785f-4521-9f22-ad30f6710ee3&amount=10"
    
or javascript code:
   
    const apiKey = '0843ec9c-5874-4904-9d5b-532c48516bdf'
    const licenseKey = 'e3c52ec3-785f-4521-9f22-ad30f6710ee3'
    const amount = 10
    const fetchUrl = `https://app.flexlicense.com/withdraw-client?apikey=${apiKey}&licensekey=${licenseKey}&amount=${amount}`
    const response = await fetch(fetchUrl)
    if (response.ok) {
        //...
    }                
returns:

{
    "msg":"Client debited",
    "product":"Your Product",
    "unit":"creditz",
    "amount":10
}


Create client

Endpoint :
https://app.flexlicense.com/create-client
Your application or web site might call this endpoint to create a new license key with the free trial credit set in the product page interface.

Product must not be of type 'Custom' and must have a 'Free trial' positive value for this API call to succeed.
Created account will have a license status with balance:'Free trial value', verified: false and valid: false. An email containing a validation link will be sent to the given email.
Valid field will remain false until the user clicks on the validation link.
Query parameters :
  • apikey: one of the api keys given in the 'product' section of your account.
  • email: the email attached to the new license key.
Returns:
A json object

{
    msg: string,
    key: string,
}
  • msg: informative message about this api call.
  • key: new license key.
Example
curl command:

curl -X GET \
"https://app.flexlicense.com/create-client?apikey=45027a18-98c0-46dc-a286-34ad112a9c38&email=trialuser@test.com"
or javascript code:
   
    const apiKey = '45027a18-98c0-46dc-a286-34ad112a9c38'
    const email = 'trialuser@test.com'
    const fetchUrl = `https://app.flexlicense.com/create-client?apikey=${apiKey}&email=${email}`
    const response = await fetch(fetchUrl)
    if (response.ok) {
        const newLicense = await response.json()
        const clientKey = newLicense.key;
        //...
    }              
returns:

{
    "key":"3eb46f7f-709f-4612-92a5-293a1d3eef8a",
    "msg":"New license key returned"
}