BoxlangLicenseActivate
Activates a BoxLang+ or BoxLang++ license using an email address and license key. This function connects to the Ortus Solutions licensing server to validate and activate your subscription license.
Method Signature
BoxlangLicenseActivate( email, licenseKey [, serverType ] )Arguments
email
STRING
true
The email address associated with the license account
licenseKey
STRING
true
The license key to activate
serverType
STRING
false
The server environment type: Production, Staging, or Development
Production
Return Value
Returns a STRUCT with the following keys:
success(BOOLEAN) - Whether the activation was successfulmessage(STRING) - Status message or error descriptionisValidLicense(BOOLEAN) - Whether the license is validisTrialMode(BOOLEAN) - Whether the system is in trial modeexpirationDate(STRING) - License expiration date (if applicable)
Examples
Template Syntax
// Activate a production license
<bx:script>
result = boxlangLicenseActivate(
email = "[email protected]",
licenseKey = "XXXX-XXXX-XXXX-XXXX",
serverType = "Production"
);
if ( result.success ) {
writeOutput( "License activated successfully!" );
} else {
writeOutput( "Activation failed: " & result.message );
}
</bx:script>Script Syntax
// Activate a staging license with error handling
result = boxlangLicenseActivate(
email = "[email protected]",
licenseKey = "XXXX-XXXX-XXXX-XXXX",
serverType = "Staging"
);
if ( result.success ) {
systemOutput( "✓ License activated: " & result.message );
systemOutput( "Expiration: " & result.expirationDate );
} else {
systemOutput( "✗ Error: " & result.message );
throw new Exception( result.message );
}Error Handling Example
try {
result = boxlangLicenseActivate(
email = "[email protected]",
licenseKey = "INVALID-KEY",
serverType = "Production"
);
if ( !result.success ) {
systemOutput( "Activation failed: " & result.message );
}
} catch ( Exception e ) {
systemOutput( "Exception during activation: " & e.message );
}Related
BoxlangLicenseInfo()- Get current license status and informationBoxlangLicenseRefresh()- Refresh an existing license token
Last updated
Was this helpful?
