Generate, distribute and validate license keys

How to securely distribute unique license keys on checkout and subscription signup

What are license keys?

When enabled, Checkout Page generates a unique license key (UUID v4) for each purchase or subscription. License keys are perpetual and do not expire. You control how and how often the license is used through your own implementation.

How license key validation works

  1. The customer enters their license key in your application or website.
  2. Your system sends a POST request to the Checkout Page license key validation API.
  3. Based on the response, your system grants or denies access.

How to enable license keys

  1. Go to Pages and open the checkout you want to edit.
  2. Go to Details → License keys.
  3. Toggle Generate license keys for each purchase.

A license key is generated for every successful checkout on this page.

How to distribute license keys

  • Confirmation email — included in the default confirmation email automatically. For custom emails, go to After payment → Email confirmation → Custom email, click + Add variable, and select License key.
  • Confirmation message — go to After payment → Payment confirmation → Custom message, click + Add variable, and select License key.
  • Customer portal — customers can view their license key in their customer portal.
  • Stripe and Zapier — the license key is stored in Stripe payment metadata and can be distributed via Zapier.

How do I validate license keys?

You can validate a license key with our public POST API endpoint. The validation implementation is up to you. Our endpoint lets you:

Increment the number of uses with the IncrementUses Property

Enable/disable a license key via the Charge/Subscription page in the dashboard. This will set Enabled To True / False

POST /api/v1/license-keys/validate

curl -X POST https://api.checkoutpage.co/api/v1/license-keys/validate \
  -d key="018ec4ef-4c0f-4845-bfa2-c1c7ed49d731" \
  -d incrementUses=true

RESPONSE

{
  "data": {
    "uses": 0,
    "enabled": true,
    "key": "018ec4ef-4c0f-4845-bfa2-c1c7ed49d731",
    "product": {
      "price": 9900,
      "currency": "usd",
      "type": "charge",
      "title": "The Art of Photography",
      "id": "60a4ca7ac2d2a000154644c9"
    },
    "variants": {
      "add-on-1": {
        "name": "Add-on 1",
        "selectedOption": "Yes",
        "price": 2900,
        "sku": "",
        "stripePriceId": "price_1NEUaeJ7i86GeQKlASSaG8S3",
        "stripeProductId": "prod_O0Vbl3cuaNc7UO"
      },
      "add-on-2": {
        "name": "Add-on 2",
        "selectedOption": "Yes",
        "price": 4900,
        "sku": "",
        "stripePriceId": "price_1NEUamJ7i86GeQKlbWvWDxcQ",
        "stripeProductId": "prod_O0VcqTjJjmyTiS"
      }
    },
    "charge": "60cb1b205cb2999b117cc905",
    "customer": "5b1910909bcc7200149245e7",
    "customerEmail": "jdoe@gmail.com",
    "customerName": "Jane Doe",
    "createdAt": "2021-06-17T09:51:32.245Z",
    "updatedAt": "2021-06-17T14:20:51.458Z",
    "vendor": "5aaa701149321a00145c99b9",
    "id": "60cb1b245cb2999b117cc90a"
  }
}

If you want to increment the Uses Property upon validation, you have to pass IncrementUses: true In the request.

Response properties:

Uses: integer the number of times the license has been validated with IncrementUses: true

Enabled: boolean a license key becomes enabled once the charge or subscription succeeded. When a charge or subscription is uncompleted, Enabled Will be False. You can enable and disable license keys via the Charge or Subscription page in the dashboard.

Key: string Unique uuidv4 string

Product: object Details of the product purchased

Variants: object Object of variants purchased, using variant reference as object key

Charge: string Charge ID, exists if the license belongs to a charge object

Subscription: string Subscription ID, exists if the license belongs to a subscription object

Customer: string Customer ID

CustomerEmail: string Customer email

CustomerName: string Customer name

CreatedAt: string Created date in UTC

UpdatedAt: string Last updated date in UTC

Vendor: string Your vendor ID

Id: string License ID