Skip to main content

NFusion Tenants

A tenant in the middleware represents one nFusion Solutions account and its associated configuration for fetching precious-metals pricing data.


Managing Tenants

Tenants are managed in the Filament admin panel under nFusion → Tenants.


Tenant Fields

FieldTypeDescription
namestringHuman-readable label (e.g., "Retail", "Dealers")
aliasstringnFusion subdomain — builds the base URL {alias}.nfusioncatalog.com
api_token_catalogstringName of the .env variable containing the nFusion Catalog API token (used for product price syncs)
api_tokenstring (nullable)Name of the .env variable containing the nFusion General API token (used for spot prices and other general API calls)
sales_channelstringnFusion sales channel identifier (configured in the nFusion portal)
currencystringISO currency code, e.g. USD
tier_pricing_sourceenumretail_tiers or wholesale_tiers — which price tiers to include in the API request
supports_markup_sale_pricesbooleanWhen true, sale-price overlays from the local products table are applied
healthcheck_urlstring (nullable)URL to ping (GET) after each successful sync
last_synced_attimestamp (nullable)Updated after every successful sync run
statusenumactive or inactive — inactive tenants are skipped by the scheduler

API Tokens

nFusion uses two separate API tokens for different parts of their platform:

Token fieldEnv variable conventionUsed for
api_token_catalogNFUSION_API_KEY_RETAILProduct price sync via {alias}.nfusioncatalog.com
api_tokenNFUSION_MARKET_API_KEY_RETAILGeneral / Spot API via api.nfusionsolutions.biz

Neither column stores the raw token value. Each stores the name of the .env variable that holds the actual token. At runtime, NFusionService resolves the real value via env():

// Catalog API (getPrices)
$this->catalogToken = env($this->catalogToken);

// General/Spot API (getMetalSpotPrices)
$this->apiToken = env($this->apiToken);

This ensures tokens are never exposed in the database and can be rotated by updating .env without any database changes.

important

Both API tokens are required for the WooCommerce Sync logic to work. If you are seeing sync failures, confirm both API keys exist.


nFusion API Endpoints

Catalog API (Product Prices)

The base URL is constructed from the tenant alias:

https://{alias}.nfusioncatalog.com/service/

The pricing endpoint called during each sync:

GET /service/Price/PricesByChannel
?currency={currency}
&channel={salesChannel}
&withCost=true
&withRetailTiers={true|false}
&withWholesaleTiers={true|false}
&token={api_token_catalog}

General API (Spot Prices)

Metal spot prices are fetched from the nFusion general API:

GET https://api.nfusionsolutions.biz/api/v1/Metals/spot/summary
?metals=gold,silver,platinum
&token={api_token}

The response is an array of objects, one per requested metal. The middleware normalises this into a keyed snapshot stored in the sync log and written to wp_options on WooCommerce targets:

{
"gold": { "ask": 4550.93, "bid": 4548.93 },
"silver": { "ask": 72.054, "bid": 71.204 },
"platinum": { "ask": 1893.20, "bid": 1883.20 }
}

Triggering a Manual Sync

From the Filament admin:

  1. Navigate to nFusion → Tenants.
  2. Click the Sync Prices action button next to the desired tenant.

This dispatches NFusionSyncTenantPricesJob immediately on the nfusion queue.


Healthcheck Integration

If a healthcheck_url is configured (e.g., a Healthchecks.io ping URL), the PriceSyncService issues a GET request to that URL after every successful sync. This allows external monitoring tools to alert when syncs stop running on schedule.