Skip to content

SmartBill Integration

SmartBill is the most popular invoicing and inventory SaaS in Romania. The MicroPIM SmartBill integration is a one-way PULL: MicroPIM authenticates against the SmartBill API and reads your current stock per warehouse (gestiune). From a single API call, MicroPIM creates one Warehouse per SmartBill gestiune, one Product per item that has a product code, and one WarehouseInventory row per (warehouse × product) pair.

SmartBill is treated as a source-of-truth for inventory, not as a store platform. No products, invoices, or stock changes are pushed back to SmartBill from MicroPIM.

  • An active SmartBill account (any plan that includes API access)
  • The API Token generated from your SmartBill account
  • The CIF (Romanian fiscal code) of the company in SmartBill
  • “Folosesc cod produs” enabled in SmartBill (see the disclaimer below)
  • An active MicroPIM account
FieldWhere to find it
EmailThe email you log in to SmartBill with
CIFThe fiscal code of the company in SmartBill, e.g. RO12345678
API TokenGenerated in SmartBill: Setări → Cont API → Generează token

Enable Product Codes in SmartBill (REQUIRED)

Section titled “Enable Product Codes in SmartBill (REQUIRED)”

The SmartBill /stocks endpoint only returns stock rows for products that have a product code (cod produs). Items without a code are returned without an identifier and cannot be imported into MicroPIM, because Product.sku is the unique key per organization.

The “Folosesc cod produs” option is enabled from the following menu:

  1. Go to Configurare → Configurari program → Preferințe generale (Configuration → Program Settings → General Preferences).

    SmartBill sidebar showing Configurare → Preferințe generale

  2. Check the Folosesc cod produs option (“I use product codes”), then click Salvează preferințe generale (“Save general preferences”).

    Preferințe generale page with Folosesc cod produs checked and Save button highlighted

  3. SmartBill will then prompt you to add product codes. Choose Mai târziu (“Add later”) — you can manage codes on your own schedule from Nomenclator → Produse/Servicii.

    SmartBill dialog asking to add product codes, with Mai târziu option

Once enabled, you can assign unique codes to every product. From that point on, when you add an item to an invoice the product code must be filled in too — otherwise the invoice cannot be saved.

After enabling the option, go back through your existing nomenclator and add codes to any item you want to see in MicroPIM. Items without a code will be silently skipped on every import.

  1. In MicroPIM, go to Integrations → Add Integration.
  2. Select SmartBill from the platform list.
  3. Fill in Email, CIF, and API Token.
  4. Click Test Connection to verify your credentials before saving (this issues a single cheap request to the SmartBill /stocks endpoint filtered to a non-existent warehouse, so it costs nothing).
  5. Click Save to create the integration.

One integration = one CIF. For multi-company SmartBill accounts, create one MicroPIM integration per CIF.

  1. Open your SmartBill integration’s detail page.
  2. Click Import Stocks. The request is queued immediately and processed asynchronously by the smartbill_sync worker.
  3. Refresh the page to see the result in the Recent Activity feed.
DataDirectionNotes
Warehouses (gestiuni)SmartBill → MicroPIMOne Warehouse per gestiune, keyed by SMARTBILL-{CIF}-{slug}
ProductsSmartBill → MicroPIMOne Product per productCode, created as draft with currency = RON. Existing products with the same SKU are not modified (first import wins for name/description).
Stock per warehouseSmartBill → MicroPIMOne WarehouseInventory row per (warehouse × product). Quantity is floored to an integer.
Total stockderivedProduct.stock = sum of WarehouseInventory.quantity across all SmartBill warehouses for this CIF.
Measuring unitSmartBill → MicroPIMStashed as a smartbill:unit:{x} tag on the Product (e.g. smartbill:unit:buc, smartbill:unit:kg).

Re-running Import Stocks is safe and idempotent. Each import is a snapshot:

Drift in SmartBillWhat MicroPIM does
Quantity changedWarehouseInventory.quantity is updated.
Quantity is 0 in the responseWarehouseInventory.quantity is set to 0.
Product is missing from a warehouseThe existing WarehouseInventory row for that pair is set to 0.
Product is missing from the entire responseAll its WarehouseInventory rows are zeroed; Product.stock = 0, Product.inStock = false. The Product row itself is not deleted or archived.
Warehouse was renamed in SmartBillA new Warehouse row is created in MicroPIM. The old one is kept with its zeroed inventory. (Manual merge is a future feature.)

Product.name is never overwritten on subsequent imports — first import wins. Edit the name in MicroPIM if you need to.

SmartBill returns quantities as strings that may include decimals (e.g. 12.5 kg). MicroPIM’s WarehouseInventory.quantity is an integer, so fractional values are floored (never rounded up). The activity log reports how many rows were truncated. Decimal-quantity support is on the roadmap.

Test Connection returns “Authentication failed” — your email, CIF, or API Token is wrong. Regenerate the token in SmartBill (Setări → Cont API) and update it in MicroPIM.

Import runs but creates 0 products — your SmartBill items don’t have product codes set. Enable “Folosesc cod produs” (see above) and add codes to existing items, then re-import.

Some products are missing after import — those rows had no productCode in SmartBill. Check the activity log for the skippedNoCode count, then add codes to the missing items in SmartBill.

My kg/litre products show the wrong quantity — fractional quantities are floored. A SmartBill stock of 12.5 kg becomes 12 in MicroPIM. This is intentional (“never overstate stock”) and tracked in the fractionalTruncated counter.

Two warehouses with similar names appeared in MicroPIM — the SmartBill gestiune was renamed. The new name created a new Warehouse row. The old row keeps its zeroed inventory; you can disable it.

SmartBill returns HTTP 500 — the worker retries automatically (up to 5 attempts, 2s–60s exponential backoff). Persistent failures land in the failed Messenger transport and are visible via php bin/console messenger:failed:show.

Does the integration push anything back to SmartBill? No. This is a one-way PULL of stock data. No invoices, products, or stock changes are written to SmartBill from MicroPIM.

Can I connect multiple SmartBill accounts? Yes — one integration per (account email + CIF) pair. Multi-company SmartBill setups need one MicroPIM integration per CIF.

Can I schedule imports? Not yet — for now use the Import Stocks button manually. Scheduled imports are on the roadmap.

Are the products created as published? No — every new product is created with status = draft and price = null. SmartBill doesn’t expose a sell price via the public API, so you set the price in MicroPIM before publishing.

Why are colons not used in the warehouse code? The Warehouse.warehouseCode column is restricted to letters, numbers, hyphens, and underscores. SmartBill warehouses are coded as SMARTBILL-{CIF}-{SLUG_OF_GESTIUNE_NAME}.

Need help connecting your store?

Our team offers a free 30-minute setup call — we walk you through credentials, field mapping, and your first sync. No sales pitch.