Install
openclaw skills install fgo-invoicingIssue FGO.ro invoices through the FGO API with local automation. Use for FGO tasks such as validating invoice payloads, issuing invoices, checking invoice st...
openclaw skills install fgo-invoicingUse scripts/fgo_cli.py for deterministic FGO API calls instead of ad-hoc HTTP snippets.
python scripts/fgo_cli.py validate-payload --input references/invoice-example.json --show-payloadpython scripts/fgo_cli.py emit-invoice --input <invoice.json> --dry-runpython scripts/fgo_cli.py emit-invoice --input <invoice.json> --allow-finalpython scripts/fgo_cli.py get-status --serie <SERIE> --numar <NUMAR>python scripts/fgo_cli.py print-invoice --serie <SERIE> --numar <NUMAR>python scripts/fgo_cli.py cancel-invoice --serie <SERIE> --numar <NUMAR>python scripts/fgo_cli.py reverse-invoice --serie <SERIE> --numar <NUMAR>Set these before calling FGO:
FGO_COD_UNIC — company CUI (Romanian tax ID)FGO_CHEIE_PRIVATA — FGO private API key (from FGO → Setari → Utilizatori → Generate API user)Optional overrides:
FGO_API_BASE (default: https://api.fgo.ro/v1) — use https://api-testuat.fgo.ro/v1 for testingFGO_PLATFORM_URL (default: unset) — your registered platform URL (FGO → Setari → eCommerce → Setari API). Required for invoice issuance from registered platforms; omitted if not set.FGO_TIMEOUT_SECONDS (default: 30)FGO_RETRIES (default: 2)FGO_DEBUG (default: unset) — set to 1, true, or yes to enable request/response debug logging to stderrvalidate-payload
--show-payload to inspect the full normalized form-encoded payload.emit-invoice
POST /factura/emitere.--allow-final to hit the real API.--dry-run first (prints normalized payload, no API call).--debug (or set FGO_DEBUG=1) to print full request/response to stderr.get-status
POST /factura/getstatus.print-invoice
POST /factura/print.cancel-invoice
POST /factura/anulare.delete-invoice
POST /factura/stergere.reverse-invoice
POST /factura/stornare.get-nomenclator
tara, judet, tva, banca, tipincasare, tipfactura, tipclient, valuta.FGO uses SHA-1 hash-based authentication embedded in every request body — no HTTP auth headers. The hash formula depends on the operation:
SHA1(CodUnic + CheiePrivata + Client.Denumire).toUpperCase()SHA1(CodUnic + CheiePrivata + Numar).toUpperCase()The CLI computes hashes automatically. Never expose FGO_CHEIE_PRIVATA in logs.
The invoice payload is a JSON object. The CLI converts it to form-encoded format (application/x-www-form-urlencoded) with bracket notation for nested fields, as required by the FGO API.
Both formats are accepted as input to the CLI:
{ "CodUnic": "...", "Client": {...}, ... }{ "invoice": { "CodUnic": "...", "Client": {...}, ... } }The CLI unwraps automatically, injects Hash and PlatformaUrl, then posts to FGO.
See references/invoice-example.json for the canonical minimal example and references/fgo-api.md for complete field documentation.
The --input argument is validated before any file is read:
.json files are accepted. Passing /etc/passwd, ~/.ssh/id_rsa, or any non-JSON path raises an error immediately./tmp/openclaw, ~/.openclaw/workspace, etc.). Paths that escape these roots via ../ traversal or absolute references are rejected.Always pass --input with a path to a file you created (e.g. a temp file written in the agent workspace). Never set --input to a path supplied by untrusted external content.
--dry-run first to confirm the normalized payload before hitting the API.Success: true in the response.Success: false with a timeout message, the invoice was NOT issued — retry.Numar verbatim as the exact string (may be zero-padded, e.g. "001"). Never strip leading zeros or cast to integer.--base-url https://api-testuat.fgo.ro/v1) for testing.references/fgo-api.md for payload field reference, endpoint mapping, authentication details, and rate-limit notes.references/invoice-example.json as the canonical starting payload template.