Xtopay

Digital Commerce & Licenses

Issue license keys, validate user activations, track activations counts, and modify licenses.

Digital Commerce & Licenses

Xtopay supports digital commerce workflows. You can sell software packages, ebooks, subscriptions, or membership access. For software and SaaS products, Xtopay provides a built-in License Key Management API to issue, validate, and track software activations across devices.


License Key Lifecycle & States

When a customer purchases software, you can generate a secure license key. License keys track device installations and activation counts, and progress through these states:

StatusDescription
ACTIVEThe license is active and can record activations.
SUSPENDEDThe license is temporarily suspended and cannot validate or record activations.
EXPIREDThe license has passed its expiry date and is inactive.
REVOKEDThe license is permanently deactivated and can never be re-used.

Issue a License Key

Generate a new unique software license key for a customer.

DetailDescription
API Endpointhttps://api.xtopay.co/v1/licenses
Request TypePOST
Content Typeapplication/json
AuthenticationBasic Base64(clientId:clientSecret)
Required Scopelicenses:write

Request Parameters

ParameterTypeRequiredDescription
customerIdStringYesThe ID of the customer receiving this license.
productIdStringNoOptional ID of the product to bind this license to.
maxActivationsIntegerNoMaximum allowed device installations. Defaults to 1.
expiresAtStringNoISO 8601 date string representing the key's expiration.
metadataObjectNoFlat key-value object containing license metadata.

Code Examples

curl https://api.xtopay.co/v1/licenses \
  -u "YOUR_CLIENT_ID:YOUR_CLIENT_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "customerId": "cust_cl8z2l8820000a",
    "productId": "prod_cl8z2j8820000b",
    "maxActivations": 3,
    "expiresAt": "2027-06-05T12:00:00Z"
  }'

Sample Response

201 Created

{
  "success": true,
  "data": {
    "id": "lic_cl8z2m8820000c",
    "key": "A9E3-8F2D-C1B0-77E5",
    "status": "ACTIVE",
    "environment": "TEST",
    "activations": 0,
    "maxActivations": 3,
    "expiresAt": "2027-06-05T12:00:00Z",
    "revokedAt": null,
    "metadata": null,
    "createdAt": "2026-06-05T12:00:00Z",
    "customer": {
      "id": "cust_cl8z2l8820000a",
      "name": "Yaw Mensah",
      "email": "yaw@example.com"
    },
    "product": {
      "id": "prod_cl8z2j8820000b",
      "name": "Cloud Hosting Standard"
    }
  }
}

Validate a License Key

Check if a license key is valid, active, and has device activations remaining. Run this check during app boot or authorization loops.

DetailDescription
API Endpointhttps://api.xtopay.co/v1/licenses/:key
Request TypeGET
AuthenticationBasic Base64(clientId:clientSecret)
Required Scopelicenses:read

Path Parameters

ParameterTypeRequiredDescription
:keyStringYesThe license key token (e.g. A9E3-8F2D-C1B0-77E5).

Code Examples

curl https://api.xtopay.co/v1/licenses/A9E3-8F2D-C1B0-77E5 \
  -u "YOUR_CLIENT_ID:YOUR_CLIENT_SECRET"

Sample Response

200 OK

{
  "success": true,
  "data": {
    "id": "lic_cl8z2m8820000c",
    "key": "A9E3-8F2D-C1B0-77E5",
    "status": "ACTIVE",
    "activations": 1,
    "maxActivations": 3,
    "expiresAt": "2027-06-05T12:00:00Z"
  }
}

Record an Activation

Increment the activation counter when the software is installed on a new device or server.

DetailDescription
API Endpointhttps://api.xtopay.co/v1/licenses/:key/activate
Request TypePOST
AuthenticationBasic Base64(clientId:clientSecret)
Required Scopelicenses:write

[!IMPORTANT] The activation request will fail with a 400 Bad Request validation error if the license key status is not ACTIVE, if the key is expired, or if the activations count has already reached maxActivations.

Path Parameters

ParameterTypeRequiredDescription
:keyStringYesThe license key token to activate.

Code Examples

curl -X POST https://api.xtopay.co/v1/licenses/A9E3-8F2D-C1B0-77E5/activate \
  -u "YOUR_CLIENT_ID:YOUR_CLIENT_SECRET"

Sample Response

200 OK

{
  "success": true,
  "data": {
    "id": "lic_cl8z2m8820000c",
    "key": "A9E3-8F2D-C1B0-77E5",
    "status": "ACTIVE",
    "activations": 2,
    "maxActivations": 3
  }
}

Modify a License

Extend expiration dates, suspend keys, or change device limits.

DetailDescription
API Endpointhttps://api.xtopay.co/v1/licenses/:key
Request TypePATCH
Content Typeapplication/json
AuthenticationBasic Base64(clientId:clientSecret)
Required Scopelicenses:write

Path Parameters

ParameterTypeRequiredDescription
:keyStringYesThe license key token to modify.

Request Parameters

ParameterTypeRequiredDescription
statusStringNoSet key status: ACTIVE, SUSPENDED.
maxActivationsIntegerNoUpdate maximum device activation limit.
expiresAtStringNoUpdate expiration ISO date string (pass null to remove expiry).
metadataObjectNoReplace the key metadata payload.

Code Examples

curl -X PATCH https://api.xtopay.co/v1/licenses/A9E3-8F2D-C1B0-77E5 \
  -u "YOUR_CLIENT_ID:YOUR_CLIENT_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "status": "SUSPENDED"
  }'

Revoke a License

Permanently revoke a license key. Once revoked, a license cannot be re-activated or modified.

DetailDescription
API Endpointhttps://api.xtopay.co/v1/licenses/:key
Request TypeDELETE
AuthenticationBasic Base64(clientId:clientSecret)
Required Scopelicenses:write

Path Parameters

ParameterTypeRequiredDescription
:keyStringYesThe license key token to revoke.

Code Examples

curl -X DELETE https://api.xtopay.co/v1/licenses/A9E3-8F2D-C1B0-77E5 \
  -u "YOUR_CLIENT_ID:YOUR_CLIENT_SECRET"

Sample Response

200 OK

{
  "success": true,
  "data": {
    "key": "A9E3-8F2D-C1B0-77E5",
    "status": "REVOKED",
    "revokedAt": "2026-06-05T12:50:00Z"
  }
}

How is this guide?

Edit this page on GitHub
Last updated on June 6, 2026

On this page