Skip to main content

Configuration Reference

All Embedded Local SDKs accept configuration as either a YAML file path (init(path)) or an inline JSON object (initWithConfig(json)). Both methods accept the same fields.

Initialization Methods

File-based: fiscal_init(path)

Pass a path to a YAML or JSON file. If NULL or empty, the engine uses built-in defaults with environment variable overrides.

# fiscalization.yaml
country: ES
tax_id: B12345678
environment: sandbox
api_key: zyn_test_abc123
live_mode: false

storage:
backend: sqlite
sqlite_path: ./fiscalization.db

certs:
dir: ./certs

submission:
auto_submit: true
retry_max: 3
retry_delay_secs: 60

logging:
level: info

Inline: fiscal_init_with_config(json)

Pass a JSON string directly. Useful for environments where file access is restricted (Android, WASM) or when config comes from your own settings store.

zyntem_fiscal.init_with_config({
"country": "ES",
"tax_id": "B12345678",
"environment": "sandbox",
"api_key": "zyn_test_abc123",
})

Configuration Fields

Required

FieldTypeDescription
countrystringISO 3166-1 alpha-2 country code (e.g. "ES", "PT", "FR", "IT")
tax_idstringMerchant VAT / tax identification number

Authentication

FieldTypeDefaultDescription
api_keystring$ZYNTEM_API_KEYAPI key for token provisioning. Falls back to the ZYNTEM_API_KEY environment variable if not set
environmentstring"production""sandbox" or "production". The SDK validates that the key prefix matches: zyn_test_* requires "sandbox", zyn_live_* requires "production"
live_modebooleanfalseMust be true for production use with zyn_live_* keys. Also controlled by FISCALIZATION_LIVE_ENABLED env var

Storage

FieldTypeDefaultDescription
storage.backendstring"sqlite""sqlite" for Embedded SDK, "postgres" for Cloud API server
storage.sqlite_pathstring"./fiscalization.db"Path to the SQLite database for local storage

Certificates

FieldTypeDefaultDescription
certs.backendstring"filesystem""filesystem" or "secretmanager" (GCP Secret Manager)
certs.dirstring"./certs"Directory for PKCS#12 certificate files (filesystem backend)
certs.passwordstring""PKCS#12 password. Prefer FISCALIZATION_CERTS_PASSWORD env var
certs.secretmanager.projectstring--GCP project ID (secretmanager backend only)

Submission

The submission queue stores fiscalized transactions locally and submits them to the tax authority in the background.

FieldTypeDefaultDescription
submission.auto_submitbooleantrueAutomatically submit prepared records to the tax authority
submission.retry_maxinteger3Maximum retry attempts at the engine level
submission.retry_delay_secsinteger60Base delay between retries in seconds

The queue itself retries up to 20 attempts per entry with exponential backoff (starting at 2s, doubling each attempt, capped at 6 hours). After exhausting all attempts, entries move to dead status.

Logging

FieldTypeDefaultDescription
logging.levelstring"info""error", "warn", "info", "debug", "trace". Also overridden by FISCALIZATION_LOG_LEVEL env var

Country-Specific

Country-specific fields go in a country_config object. See the country guides for details:

  • Spain -- system, territory, certificate_id
  • France -- siret, naf_code, signing key
  • Italy -- system (sdi/dc), codice_fiscale, cau_code
  • Portugal -- software_certificate_number, series, atcud_code

Environment Variables

Environment variables override config file values. Useful for containerized deployments and CI.

VariableOverridesExample
ZYNTEM_API_KEYapi_keyzyn_live_abc123
ENVIRONMENTenvironmentproduction
FISCALIZATION_LIVE_ENABLEDlive_modetrue
FISCALIZATION_CERTS_DIRcerts.dir/data/certs
FISCALIZATION_CERTS_PASSWORDcerts.password(secret)
FISCALIZATION_STORAGE_BACKENDstorage.backendsqlite
FISCALIZATION_LOG_LEVELlogging.leveldebug
FISCALIZATION_SUBMISSION_AUTOsubmission.auto_submittrue
FISCALIZATION_SUBMISSION_RETRY_MAXsubmission.retry_max3
FISCALIZATION_SUBMISSION_RETRY_DELAYsubmission.retry_delay_secs60

Platform Notes

Android

File paths are relative to the app's internal storage. Use initWithConfig() with a JSON string instead of file paths:

FiscalEngine.initWithConfig("""
{
"country": "ES",
"tax_id": "B12345678",
"environment": "sandbox",
"api_key": "zyn_test_abc123",
"storage": {"sqlite_path": "${context.filesDir}/fiscalization.db"}
}
""")

WASM / Browser

The WASM build does not support the submission queue or file-based config. Use initWithConfig() with inline JSON. Queue submission must be handled by your backend via the Cloud API.

initialize(JSON.stringify({
country: "ES",
tax_id: "B12345678",
environment: "sandbox",
api_key: "zyn_test_abc123",
}));

.NET

Config file discovery works from the application's working directory. For Windows services, set environment variables to absolute paths.

Init Response

Both init() and initWithConfig() return a JSON string:

// Success
{"status": "ok"}

// Failure
{"status": "error", "error_message": "missing required field: country"}

Always check status before calling processTransaction(). See Embedded Error Handling for the full list of init errors.