API Reference
This document describes the Open Payments API. These APIs are exposed as REST services
and return JSON formatted data. You can refer to the examples in the definitions
below to get a better view of the flow of information. The base URL where most of
the services reside is at https://www.cloud4apps.com/Services/. All
methods return by default JSON formatted data but they also support JSONP responses.
The callback function name can be specified using the "callback" keyword in the
first Url query parameter; i.e. https://www.cloud4apps.com/Services/Ping?callback=mymethod
would return: mymethod(true);
Ping (GET)
Used to check if service is healthy
AppLog (POST)
Stores an event to the app log
Parameters
|
clientId
|
(
string
)
This is a unique identifier that associates the data to its owner. Normally this value is the email address of the app user, but if it is not possible to retrieve this value then the next alternative could be the phone number or device id.
|
|
appKey
|
(
string
)
This is the identifier that cloud4apps generates when an app is defined.
|
|
logCode
|
(
string
)
Max Lenght: 10 Chars. A short identifier for the event.
|
|
logMessage
|
(
string
)
Max Lenght: 2000 Chars. The message associated to the event.
|
|
logDetail
|
(
string
)
Additional details for the event.
|
|
logStackTrace
|
(
string
)
Stack trace (in case it is available)
|
Purchase
This URL opens a page where your customers can place purchases on the apps you have defined. It is optimized for touch enabled devices and both small and large screens.
Parameters
|
appKey
|
(
string
)
This is the identifier that cloud4apps generates when an app is defined.
|
|
clientId
|
(
string
)
This is a unique identifier that associates the license to its owner. Normally this value is the email address of the app user, but if it is not possible to retrieve this value then the next alternative could be the phone number or device id.
|
|
email
|
(
string
)
This is the user's email address. If email address can't be retrieved from the device it can be left empty for the user to fill out from the cloud4apps purchase form.
|
|
showSandbox
|
(
boolean
)
When this value is set to true, the cloud4apps purchase form will include in the forms of payment section any Sanbox forms of payments you might have defined for your app. This is specially useful during testing when you want to ensure the payment flow is setup properly and working correctly based on your settings. However, in normal conditions you should skip passing this parameter.
|
LicenseInfo Type
This describes the LicenseInfo data type that is returned by some of the APIs exposed by Open Payment services.
Parameters
|
LicenseNumber
|
(
string
)
Unique identifying number associated to the license.
|
|
VersionKey
|
(
string
)
The version key that uniquely identifies the app version. This key is assigned when you add a new version to your application and can be found from the cloud4apps site under [Apps], then choosing the app version.
|
|
VersionName
|
(
string
)
The name associated to this particular app version
|
|
IsTrial
|
(
boolean
)
Indicates if this license is a trial license
|
|
TrialHoursRemaining
|
(
int
)
If trial is true this will contain the number of hours remaining for the trial
|
|
IsActive
|
(
boolean
)
Indicates if this particular license is active or not. An active license is one of the following license statuses: Active, Restored, Trial, Auto-Activated, or Email Activated
|
Example
|
Request
|
https://www.cloud4apps.com/Services/GetLicenses?clientId=myId@test.com&appKey=67633142-287b-4457-9841-d87e4ff8aee3
|
|
Response
|
{{"LicenseNumber":"2fb907c4-2c40-52de-a9d3-5103b81cb750","VersionKey":"91dc4021-a11a-5fc6-bad8-a544b3c98d46","VersionName":"Sample App Premium Version","IsTrial":false,"TrialHoursRemaining":0,"IsActive":true}{"LicenseNumber":"3fb907c4-2c40-52de-a9d3-5103b81cb750","VersionKey":"81dc4021-a11a-5fc6-bad8-a544b3c98d46","VersionName":"Sample App Trial Version","IsTrial":true,"TrialHoursRemaining":2,"IsActive":true}}.
|
LicenseInfo[] Licenses (GET)
Parameters
|
clientId
|
(
string
)
This is a unique identifier that associates the license to its owner. Normally this value is the email address of the app user, but if it is not possible to retrieve this value then the next alternative could be the phone number or device id.
|
|
appKey
|
(
string
)
This is the identifier that cloud4apps generates when an app is defined.
|
Returns
|
LicenseInfo[]: It returns zero or more licenses the given clientId has associated for a particular app based on the appKey
|
Example
|
Request
|
https://www.cloud4apps.com/Services/Licenses?clientId=myId@test.com&appKey=67633142-287b-4457-9841-d87e4ff8aee3
|
|
Response
|
{{"LicenseNumber":"2fb907c4-2c40-52de-a9d3-5103b81cb750","VersionKey":"91dc4021-a11a-5fc6-bad8-a544b3c98d46","VersionName":"Sample App Premium Version","IsTrial":false,"TrialHoursRemaining":0,"IsActive":true}{"LicenseNumber":"3fb907c4-2c40-52de-a9d3-5103b81cb750","VersionKey":"81dc4021-a11a-5fc6-bad8-a544b3c98d46","VersionName":"Sample App Trial Version","IsTrial":true,"TrialHoursRemaining":2,"IsActive":true}}
|
LicenseInfo GetPriciestActiveLicense (GET)
This method finds from all possible active licenses a given client could have for an specific app and returns the priciest one. For instance suppose user installs an app and activates its trial license. Then he decides to buy the app and purchases it through cloud4apps. When the GetPriciestActiveLicense methd is invoked with the appKey for the app it will return the license information for the license the customer payed for since the trial license has no cost.
Parameters
|
clientId
|
(
string
)
This is a unique identifier that associates the license to its owner. Normally this value is the email address of the app user, but if it is not possible to retrieve this value then the next alternative could be the phone number or device id.
|
|
appKey
|
(
string
)
This is the identifier that cloud4apps generates when an app is defined.
|
Returns
|
LicenceInfo: It returns license information for the priciest active license associated to a given clientId and appKey.
|
boolean IsLicenseActive (GET)
This checks for a given license number if the license is active. License number can be obtained from any of the methods that return LicenseInfo type.
Parameters
|
licenseNumber
|
(
string
)
This is a unique identifier associated to the license for a given app version and user.
|
Example
|
Request
|
https://www.cloud4apps.com/Services/IsLicenseActive?licenseNumber={licenseNumber}
|
|
Response
|
{true}
|