CLI Commands
The module provides generation, XML XSD validation, amount-checking and storage-migration commands. Run them from the Magento root as the normal deployment user.
Generate documents
Single entity:
php bin/magento einvoice:generate --invoice-id=42
php bin/magento einvoice:generate --creditmemo-id=17
Multiple entities:
php bin/magento einvoice:generate --invoice-ids=42,43,44
php bin/magento einvoice:generate --creditmemo-ids=17,18
Use -v to show the per-entity table for a batch. Every ID is a numeric entity ID, not an increment ID such as 000000042. The command runs without force: already generated entities are skipped, and an error entity cannot be retried this way — use the admin detail-page action or the REST force flag for that.
The command uses the document's store-view configuration and the store-level default format. It does not send the result to a recipient.
Validate an XML file against its bundled XSD
Use the file path and the matching CII format:
php bin/magento einvoice:validate var/einvoice/invoice-000000042-xrechnung.xml \
--format=xrechnung --profile=3.0
Supported XSD format codes are zugferd, facturx, xrechnung and en16931. The profile is optional. It defaults to 3.0 for XRechnung and en16931 for the other supported formats. PEPPOL BIS is UBL and is not an option for this command; use the admin validation action or the module's PEPPOL-specific checks, then apply the provider's Schematron/business-rule validator.
The command checks XML against the selected bundled schema. A successful result does not prove tax semantics, PEPPOL acceptance, PDF embedding or transmission.
Verify CII amounts from an actual file
The safest usage is to pass the exact XML path:
php bin/magento einvoice:verify-amounts \
--file=var/einvoice/invoice-000000042-zugferd.xml
You can change the comparison tolerance when the accounting team has approved it:
php bin/magento einvoice:verify-amounts \
--file=var/einvoice/invoice-000000042-zugferd.xml \
--tolerance=0.01
The command reads CII summation values and checks:
| Rule | Check |
|---|---|
| BR-CO-13 | tax basis equals line total minus allowances plus charges |
| BR-CO-15 | grand total equals tax basis plus tax total plus rounding |
| BR-CO-16 | payable amount equals grand total minus prepaid amount |
It exits 0 when all checks pass and 1 for a mismatch or unreadable file.
Entity-ID verification
The command also exposes:
php bin/magento einvoice:verify-amounts --invoice-id=42
php bin/magento einvoice:verify-amounts --creditmemo-id=17
These options load the persisted private XML artifact stored for that entity — the file must exist (permanent storage). For on-demand storage or a file elsewhere on disk, use --file with the actual path.
The amount reader is based on the CII library. Do not use it as proof of PEPPOL UBL correctness.
Migrate public artifacts to private storage
Documents written by older module versions under pub/media can be moved into the private var/ storage:
# dry run first: report planned copies without changing anything
php bin/magento einvoice:storage:migrate-public --entity-type=invoice --dry-run
# migrate a batch
php bin/magento einvoice:storage:migrate-public --entity-type=invoice --batch-size=100
# resume after a given entity ID
php bin/magento einvoice:storage:migrate-public --entity-type=creditmemo --after-id=500
Options:
--entity-type(required):invoiceorcreditmemo;--after-id: resume after this entity ID (default0);--batch-size: entities per run,1–10000(default100);--dry-run: verify public sources and report planned copies without changing files;--cleanup-public: delete public copies after a completed migration run;--confirm-public-cleanup: additionally confirm deletion — only applied when the private copy has the same size and SHA-256 hash.
What amount verification does not prove
It checks a small set of totals. It does not validate addresses, identifiers, VAT category choices, profiles, buyer references, Schematron rules, PDF embedding or delivery acceptance.