Public services for NetSeller plugins
Resolve a service during a request with request.getApplicationService(name), then pass it to your plugin-owned service as a dependency. Only the services and methods listed here are part of this plugin runtime contract. A service being present in the application does not make it public API.
Credential vault
Section titled “Credential vault”Service: pluginCredentialVaultService.
| Method | Input | Result |
|---|---|---|
isConfigured() |
None | Boolean: deployment encryption is available. |
encryptCredential(plainText) |
string | Encrypted string to persist in your own table. |
decryptCredential(encryptedValue) |
string previously encrypted by this vault | Plaintext string for an authorized outbound request. |
The vault does not store values. Keep encrypted data in plugin-owned tables and the deployment encryption key outside the package. See the credential example.
Shop selector
Section titled “Shop selector”Service: pluginShopContextService.
getActiveShops(datasource) takes the current datasource name and returns an array of structs:
| Field | Meaning |
|---|---|
shopId |
Numeric shop ID. |
key |
Technical shop key. |
name |
Display name. |
defaultLanguageId |
Default language ID. |
Use this list for shop-scoped settings. It is not filtered to a particular user’s authorization; enforce access in your plugin.
Order export snapshot
Section titled “Order export snapshot”Service: pluginOrderExportSnapshotService.
var snapshotService = request.getApplicationService("pluginOrderExportSnapshotService");var snapshot = snapshotService.getOrderExportSnapshot( datasource = arguments.datasource, shopId = arguments.shopId, orderId = arguments.orderId, languageId = arguments.languageId, fallbackLanguageId = arguments.fallbackLanguageId);if (structIsEmpty(snapshot)) { return {};}Required arguments are datasource (string), shopId and orderId (numbers). Optional languageId and fallbackLanguageId default to zero. Invalid IDs or an order outside the requested shop return {}.
A successful result contains order, the prepared order snapshot, and revision, its update marker. The order contains its saved totals, addresses, item snapshots, payment, shipping, adjustments and tax breakdown. Export these saved order values rather than recalculating from the current catalog. Address custom fields include only connector-visible data; internal custom-field IDs and visibility flags are removed.
Treat the result as read-only. The service does not authorize the caller or send anything to an external system; your route and plugin own those decisions.
Custom fields
Section titled “Custom fields”Service: customFieldService. The plugin contract allows provisioning your own sets and definitions and reading prepared values through the methods below. Do not assume all other methods on that service are plugin APIs.
Create or update a set
Section titled “Create or update a set”saveSet() accepts:
| Argument | Type / default | Meaning |
|---|---|---|
datasource |
string, required | Current datasource. |
key, label |
strings, required | Stable technical key and display label. |
customFieldSetId |
number, 0 | Zero creates; a stored ID updates. |
description |
string, empty | Optional description. |
sortOrder |
number, 0 | Display order. |
isActive |
boolean, true | Set availability. |
assignments |
string[], empty | Entity types, such as product or customer. |
shopIds |
number[], empty | Shop assignments. |
translations |
array, empty | Localized set labels/descriptions. |
It returns {success, errors, set}. Check success before reading the saved set. Keep its customFieldSetId in your plugin’s provisioning state.
Create or update a definition
Section titled “Create or update a definition”saveDefinition() requires datasource, customFieldSetId, key, label and fieldType. Optional arguments are customFieldDefinitionId=0, description="", defaultValue, sortOrder=0, isRequired=false, isActive=true, isLineItemInput=false, lineItemMaxLength=120, translations=[] and options=[].
Field types are text, textarea, rich_text, number, boolean, date, single_select, multi_select, media and url. Boolean defaults use "1" or "0". It returns {success, errors, definition}; retain the resulting customFieldDefinitionId.
Use namespaced technical keys and update your own stored IDs on repeated activation. Calling create again with the same key is not an idempotent provisioning strategy. The calls save the submitted translations, assignments or options; retain the existing values you want to keep when updating.
For set and definition translations, supply structs such as {languageId=2, label="Greeting", description="Optional description"}. Use an existing positive language ID and include both text fields. Select-field options contains structs such as {key="standard", label="Standard"}; array order determines display order. Updating options deactivates omitted entries.
Read prepared values
Section titled “Read prepared values”getPreparedValuesForEntity(datasource, entityType, entityId, shopId=0, languageId=0, fallbackLanguageId=0, visibility="admin") returns an array. Each entry includes:
- Identification:
customFieldDefinitionId,setId,setKey,key. - Labels:
setLabel,setDescription,label,description. - Values:
type,value(display value),rawValue,hasValue,usesDefaultValue. - Availability: active, required and visibility flags.
A default is used only while no value is stored. An explicitly stored value wins. Pass the correct shop, language and visibility context; do not expose admin-only values in storefront responses.
Supported entities are product, product_variant, category, customer, customer_address, customer_company, customer_company_address, customer_order and manufacturer.
Request helpers for admin pages
Section titled “Request helpers for admin pages”| Helper | Use |
|---|---|
request.buildUrl(routeName, params) |
Generate links respecting the configured base path. |
request.t(key, fallback) |
Resolve interface text. |
request.adminCan(permissionKey) |
Check a permission when preparing a view or action. |
request.renderCsrfTokenInput() |
Render the hidden input in a POST form. |
request.getCsrfTokenHeaderName(), request.getCsrfToken() |
Prepare the CSRF header for JavaScript requests. |
request.renderAdminIcon(name, className, size, strokeWidth) |
Use the shared admin icon renderer. |
For background execution there is no browser request context. Pass required dependencies and datasource explicitly; do not assume these helpers exist in a scheduled process.