Licence model

A BeanGuard licence is a set of customer data, an expiration date, and an arbitrary set of key–value pairs (claims) that your application's limits and features are based on.

Core fields

FieldDescription
key / secretThe licence identifier and its secret — the customer uses this pair to activate the licence in their application
expirationExpiration date
companyName, street, postCode, city, vatId, email, phoneNumberLicence purchaser's details
typeSTANDARD or DEMO
claimsA String → String map — where limits and feature flags live
netAmountThe net amount of the order associated with the licence

Limits and features in claims

claims has no predefined structure — you decide which keys go in there, and reference them in your application via licensing annotations:

  • Limit — a numeric value as a string, e.g. claims["active-users"] = "10". Checked by @RequiresLicenceLimit.
  • Feature"true" or "false", e.g. claims["advanced-reports"] = "true". Checked by @RequiresLicenceFeature.

Demo licences

The server can automatically issue DEMO licences — their default set of claims and validity period are configured with the LICENCE_DEMO_CLAIMS and LICENCE_DEMO_EXPIRATION_DAYS parameters (see Licence server). Once a demo licence is issued, the server sends the customer a welcome email — SMTP configuration is in the MAIL_* parameters.

Shop products

In the shop, every product is one of two types:

  • LIMIT — the purchase raises the value of a specific limit in the customer's claims
  • FEATURE — the purchase sets a feature flag to "true"

An order goes through the statuses NEWACCEPTED (licence updated) or NEWCANCELED.

NIP validation

beanguard-api provides a @PolishNIP validator to check the correctness of a Polish tax ID (NIP) in order forms — verifying the checksum, not just the format.

Was this page helpful?