License

../../../../_images/step-project2.png ../../../../_images/step-meta2.png ../../../../_images/step-provision-b.png ../../../../_images/step-presentation1.png ../../../../_images/step-deploy2.png ../../../../_images/step-provisioning2.png

The licenses service and license APS type will implement the application SKUs offering various kinds of services to customers.

../../../../_images/step-provision-app.png ../../../../_images/step-provision-lic-b.png ../../../../_images/step-provision-tenant.png

Service and Type Definition

Declare the following properties for the license APS type in the scripts/licenses.php file:

  1. The license name must reflect the respective SKU name it represents for sale:

    /**
     * @type(string)
     * @title("LicenseName")
     * @required
     * @description("Human readable license name")
     */
    public $name;
    
  2. Human readable license description:

    /**
     * @type(string)
     * @title("LicenseDescription")
     * @description("Human readable license description")
     */
    public $description;
    
  3. A set of scopes to be sold to customers:

    /**
     * @type(string[])
     * @title("Scopes")
     * @required
     * @description("Authorized scopes on the App side assigned to a particular token")
     */
    public $scopes = array("repo");
    

Conclusion

You have completed the configuration of the licenses service and the license APS type in scripts/licenses.php. If there are any problems, compare it with the sample app.php file:

<?php

	define('APS_DEVELOPMENT_MODE', true);
	require "aps/2/runtime.php";	

	/**
	* @type("http://aps-standard.org/samples/github/license/1.0")
	* @implements("http://aps-standard.org/types/core/profile/service/1.0")
	*/

	class license extends \APS\ResourceBase
	{
		/**
         * @link("http://aps-standard.org/samples/github/app/1.0")
         * @required
         */
        public $app;

        /**
         * @link("http://aps-standard.org/samples/github/tenant/1.0[]")
         */
        public $tenants;

        ## The license name to represent a product SKU
        /**
         * @type(string)
         * @title("LicenseName")
         * @required
         * @description("Human readable license name")
         */
        public $name;

        ## Just a human readable description.
        /**
         * @type(string)
         * @title("LicenseDescription")
         * @description("Human readable license description")
         */
        public $description;

        ## The only property that allows creating various App reference resources - App licenses.
        /**
         * @type(string[])
         * @title("Scopes")
         * @required
         * @description("Authorized scopes of resources on the App side for a token generated for a customer")
         */
        public $scopes = array("repo");

    }
?>