Sales Channel Parameters

Sales channel parameters are key-value pairs scoped to a specific sales channel. They store per-channel configuration such as API credentials, sync timestamps, feature flags, and import settings.

Why Per-Channel Configuration?

A single app instance may manage multiple sales channels (e.g., a German store and a US store). Each channel needs its own:

  • Platform API credentials

  • Last import/sync timestamps

  • Feature toggles (which sync types are enabled)

  • Import preset references

  • Platform-specific settings (API version, store URL, etc.)

Storage Approaches

Since external developers don't have access to internal VARIO middleware APIs, there are several approaches for storing per-channel configuration:

Using EAV Groups

Store channel parameters in an EAV group keyed by the sales channel ID:

const ErpApi = require('@vario-software/vario-app-framework-backend/api/ErpApi');

// Store a parameter
async function setChannelParameter(salesChannelId, key, value)
{
  const groupKey = `my-shop-channel-${salesChannelId}`;

  await ErpApi.eav.changeGroup(groupKey, (data) =>
  {
    data[key] = value;
    return data;
  });
}

// Retrieve a parameter
async function getChannelParameter(salesChannelId, key)
{
  const groupKey = `my-shop-channel-${salesChannelId}`;
  const group = await ErpApi.eav.getGroup(groupKey);

  return group?.data?.[key] || null;
}

Using a Local Database

For data that doesn't need to persist in the ERP (like caching or temporary state), use a local database (e.g., SQLite, lowdb, or a simple JSON file):

Common Parameters

Key
Description
Example Value

LAST_ORDER_IMPORT_TIMESTAMP

When orders were last imported

2026-01-15T10:30:00Z

LAST_PRODUCT_SYNC_TIMESTAMP

When products were last synced

2026-01-15T09:00:00Z

API_KEY

Platform API key

sk_live_abc123

API_SECRET

Platform API secret

encrypted_secret

SHOP_URL

Platform store URL

mystore.myplatform.com

PLATFORM_VERSION

Platform API version

2024-01

AUTO_ORDER_IMPORT

Whether to auto-import orders

true

QUEUE_BATCH_SIZE

Queue processing batch size

10

IMPORT_PRESET_ID

ID of the import preset

preset-uuid

TRANSFER_TYPES

Enabled sync types

{"product":true,"stock":true}

Caching

Reading parameters from the ERP on every request is slow. Implement in-memory caching:

circle-info

Invalidate the cache whenever you update a parameter. Also consider adding a TTL (time-to-live) so cached values automatically refresh periodically.

Credential Storage

Platform API credentials require special care:

  • Never log credentials — Use the secret option on API requests to mask sensitive data

  • Encrypt at rest — If storing credentials in a local database, encrypt them

  • Rotate regularly — Support credential rotation without downtime

Last updated

Was this helpful?