This is the api documentation for the FlexLicense service.
https://app.flexlicense.com/ipn_notification
This endpoint is the Paypal IPN callback to be set in your Paypal settings.
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.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.
{
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.
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"
}
https://app.flexlicense.com/withdraw-client
Your application or web site will call this endpoint to withdraw some credit from your client account.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.
{
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.
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
}
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.apikey
:
one of the api keys given in the 'product' section of your account.
email
:
the email attached to the new license key.
{
msg: string,
key: string,
}
msg
:
informative message about this api call.
key
:
new license key.
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"
}