Provision a fixed-term license

A fixed-term license means that the customer pays a fee to access a software application for a defined period of time. In 10Duke Enterprise, what defines a license as a fixed-term license is that it has a validity start and end date defined.

Fixed-term licenses are used with both B2B and B2C customers. They’re typically set up with a long validity period (such as 12 months), but you can use any period of time that suits your business requirements.

This article explains how to provision (grant) a fixed-term license using the 10Duke Entitlement Management REST API. For background, see how license provisioning through the API uses the concept of a transaction.

The article assumes you have connected your client application to 10Duke Enterprise and implemented license consumption for it.

API operations

10Duke Entitlement Management REST API operations:

Item URL (relative, prepend the environment base URL)
Provision a license to an organization POST /organizations/{orgId}/license-transactions
Provision a personal license to a user POST /users/{userId}/license-transactions

Example

This example shows how to provision a fixed-term license to a consumer customer.

The example uses the following business case:

  • Product being sold: CutXPro, a B2C desktop software application that allows end users to crop elements from photographs

  • Quantity sold: 1 license

  • Product package in 10Duke Enterprise: Name CutXPro, product ID 0aa228a2-d3bc-4934-9069-658333c03780

  • Customer: A B2C customer

  • License terms: The license is sold for a fixed term of 12 months

Request example

Send a POST request to users/{userId}/license-transactions. See the API reference for details on the API path parameters, request body, and response schemas.

This example request uses curl (line breaks added for display purposes). The request specifies licenseValidFrom and licenseValidUntil dates to set a 12-month validity for the license.

curl --request POST
   --url <API_base_path>/users/me/license-transactions
   --header 'content-type: application/json'
   --data '{"transaction":{"type":"Order","externalId":"0000004556786","items":[{"externalId":"0001","productId":"0aa228a2-d3bc-4934-9069-658333c03780","quantity":1,"licenseValidFrom":"2023-02-19T14:12:22.012Z","licenseValidUntil":"2024-02-19T14:12:22.012Z"}]}}'

Response example

This sample response shows information that the response body can contain:

{
   "transaction": {
      "id": "8ec39f9d-f739-4bc1-aa55-8cb712e50adb",
      "type": "Order",
      "externalId": "0000004556786",
      "processed": "2023-02-19T14:12:22.010Z",
      "items": [{
         "id": "",
         "externalId": "0001",
         "productId": "0aa228a2-d3bc-4934-9069-658333c03780",
         "quantity": 1,
         "licenseValidFrom": "2023-02-19T14:12:22.012Z",
         "licenseValidUntil": "2024-02-19T14:12:22.012Z",
         "licenses": [{
            "id": "48e04c21-1fae-4ddf-ab5a-e0644039c81e",
            "validFrom": "2023-02-19T14:12:22.012Z",
            "validUntil": "2024-02-19T14:12:22.012Z",
            "active": true,
            "entitlementId": "6bde22fa-ecd4-4017-9b61-d661c33ba353",
            "licensedItem": {
               "id": "75151a68-fee2-436e-bfa7-3d9e5b94668d",
               "name": "CutXPro",
               "displayName": "CutXPro"
            },
            "licenseModelId": "1db0c182-70c4-4a51-8326-54ce29138303",
            "licenseModelName": "License_Model_for_Personal_License",
            "seatsTaken": 0,
            "seatsReserved": 0,
            "seatsTotal": 1,
            "seatCountCredits": [{
               "id": "9b6cce7d-eef2-4953-ba31-390932052501",
               "validFrom": "2023-02-19T14:12:22.012Z",
               "validUntil": "2024-02-19T14:12:22.012Z",
               "active": true,
               "licenseId": "48e04c21-1fae-4ddf-ab5a-e0644039c81e",
               "licenseTransactionItemId": "e0588c33-7055-4b28-8ec6-9e92c6f3b94f",
               "seatCount": 1,
               "seatsConsumed": 0
            }]
         }]
      }]
   }
}

Next steps

In the above example case, the consumer user now has a license and will be able to use the software application for 12 months. You can make the option to renew the license available to the user through your customer-facing e-commerce or payment provider platform. When the license expires, the user can no longer access the application.

If you provisioned a fixed-term license to an organization, authorize the organization’s users to consume the license. The license was created in the organization’s default entitlement, so add the users to a user group that has access to that entitlement. (This can also be done in advance.) You can do this through the 10Duke Identity Management REST API or using the 10Duke SysAdmin tool.