Generation Modes

The E-Invoice extension supports multiple generation modes to fit different business scenarios. These modes apply to invoices and, when enabled, to credit memos.

Overview

Mode Processing Best For
Disabled (Manual Only) No automatic generation Fully manual workflows
Immediate During invoice save Low volume, real-time needs
Queued Message queue background Medium volume, async processing
Cron Hourly Scheduled batch processing High volume, continuous batching
Cron Daily Scheduled batch processing Batch windows (e.g. nightly)

Immediate Mode

E-invoices are generated synchronously when an invoice is created.

How It Works

  1. Admin creates invoice
  2. E-invoice is generated immediately
  3. Files are saved to storage
  4. Invoice status is updated
  5. Invoice save completes

Pros & Cons

Pros Cons
Instant feedback Slows invoice creation
Real-time status Not suitable for high volume
Simple setup Errors block invoice (if configured)

Configuration

Stores > Configuration > MageB2B > E-Invoice > Invoice Settings
Generation Mode: Immediate

Queued Mode

E-invoices are added to a message queue for background processing.

How It Works

  1. Admin creates invoice
  2. Generation request is queued
  3. Invoice save completes immediately
  4. Background consumer processes queue
  5. Status is updated asynchronously

Requirements

  • Magento Message Queue configured
  • Queue consumer running:
php bin/magento queue:consumers:start mageb2b.einvoice.generate

Pros & Cons

Pros Cons
Non-blocking invoice creation Requires queue setup
Scalable Delayed status updates
Error isolation More complex monitoring

Configuration

Stores > Configuration > MageB2B > E-Invoice > Invoice Settings
Generation Mode: Queued

Cron Hourly Mode

E-invoices are generated in batches by a scheduled cron job.

How It Works

  1. Admin creates invoice
  2. Invoice is marked as "pending" e-invoice
  3. Hourly cron runs
  4. Pending invoices are processed in batch
  5. Status is updated

Schedule

The cron runs every hour at minute 0:

0 * * * * # Every hour

Pros & Cons

Pros Cons
Best for high volume Up to 1 hour delay
No queue infrastructure Less real-time visibility
Batch efficiency Errors accumulate

Configuration

Stores > Configuration > MageB2B > E-Invoice > Invoice Settings
Generation Mode: Cron Hourly

Cron Daily Mode

Cron Daily is also a batch mode, but with a daily schedule (default: 0 2 * * *).

  • Useful when you want a controlled batch window (e.g. after business hours)
  • Supports a Daily Cron Batch Size setting

Disabled / Manual Only

If you choose Disabled - Manual Only, the extension will not automatically generate E-Invoices.

You can still generate manually via:

  • Admin document view action (“Generate E-Invoice”)
  • Admin mass action (“Generate E-Invoice”)
  • CLI command (einvoice:generate)
  • REST API endpoint (POST /V1/einvoice/invoice/{invoiceId}/generate)

Choosing a Mode

Use Immediate When:

  • Processing < 100 invoices/day
  • Real-time status is important
  • Errors should immediately block workflow

Use Queued When:

  • Processing 100-1000 invoices/day
  • You have message queue infrastructure
  • Non-blocking invoice creation is important

Use Cron Hourly When:

  • Processing > 1000 invoices/day
  • Batch processing is acceptable
  • Simple infrastructure is preferred

Status Values

Status Meaning
pending Waiting for generation (queued/cron modes)
generated Successfully generated
error Generation failed
disabled E-invoicing disabled for this invoice

Monitoring

Check Pending Invoices

From admin: Sales > Invoices → Filter by e-invoice status "pending"

Logs

Check Magento logs for generation details:

  • var/log/system.log
  • var/log/exception.log

Found an issue with this documentation? Let us know