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
| Field | Description |
|---|---|
key / secret | The licence identifier and its secret — the customer uses this pair to activate the licence in their application |
expiration | Expiration date |
companyName, street, postCode, city, vatId, email, phoneNumber | Licence purchaser's details |
type | STANDARD or DEMO |
claims | A String → String map — where limits and feature flags live |
netAmount | The 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'sclaimsFEATURE— the purchase sets a feature flag to"true"
An order goes through the statuses NEW → ACCEPTED (licence updated) or NEW → CANCELED.
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.
