E-Invoice Implementation Details
← Electronic Invoices in JustOn
JustOn Billing & Invoice Management acts as the "user interface" for managing e-invoices and controls the data management. However, significant parts of the business logic to produce e-invoices, including the validation, run on the Heroku-based platform.
To support the Peppol BIS Billing and the XRechnung formats and the distribution via the Peppol Network, JustOn Billing & Invoice Management adds a number of fields to the relevant objects Invoice and Invoice Line Item as well as to the custom settings Business Entity, Quantity Units and Tax Rules.
Data Model Extension
- New fields on Invoice
-
Field Description Buyer Reference A unique identification of the invoice recipient.
When doing business with German public authorities (B2G scenarios), the buyer reference usually holds the Leitweg-ID (see ZFB | eRechnung).Contract No. Reference to the contract on which the invoice is based (see Purchase-Related Information).
Is usually given by the buyer to track the contract in their system; retrieved from a source record ( contract) and set on the invoice on invoice creation.E-Invoice Distribution Channel The distribution channel for the e-invoice.
Must be one ofE-Mail,PeppolorAvalara.E-Invoice Error Holds details regarding errors during e-invoice generation. E-Invoice Format The target format for electronic invoices.
Currently,Peppol BIS Billing UBL,XRechnung UBLand configured Avalara ELR country mandates are supported.E-Invoice Provider Status Tracks the lifecycle of the e-invoice with the distribution provider, see E-Invoice Provider Status. E-Invoice Provider Messages Holds details regarding the status in the provider queue, a JSON string including timestampandmessageset by the provider.E-Invoice Recipient Address The recipient address for an issued electronic invoice.
Addresses are subject to the Electronic Address Scheme.
When creating e-invoices in the Peppol BIS Billing format or when distributing e-invoices via the Peppol network, only a limited set of address schemes is allowed.E-Invoice Recipient Scheme Id The identifier that indicates the type of the used e-invoice recipient address. E-Invoice Recipient Legal Identifier An identifier issued by an official registration authority that uniquely identifies the e-invoice recipient or buyer as a legal entity. Required in some jurisdictions, like France (SIREN, SIRET) or Norway (Organisasjonsnummer). E-Invoice Recipient Legal ID Scheme The codified scheme identifier that indicates the type of the used e-invoice recipient legal identifier, must correspond to the ISO/IEC 6523 identifier scheme code list, like 0002for SIREN or0192for Organisasjonsnummer.E-Invoice Status Indicates the result of the e-invoice creation, see E-Invoice Status. Purchase Order No. Reference to the purchase order on which the invoice is based (see Purchase-Related Information).
Is usually given by the buyer to track the purchase in their system; retrieved from a source record ( contract) and set on the invoice on invoice creation.Seller ID An identifier of the seller (see Purchase-Related Information).
Is usually given by the buyer to track the vendor in their system; retrieved from a source record ( contract) and set on the invoice on invoice creation.Supporting Document Types Defines which file types will be embedded in the e-invoice XML (see Supporting Documents) VAT Breakdown The serialized contents (JSON) of the tax breakdown table. Is updated when invoice line items are modified. - New fields on Invoice Line Item
-
Field Description Unit Code A code for the measurement unit applicable to the invoiced quantity, is copied from Codeon the Quantity Units custom setting.
The code is expected to be one of the codes listed in UNECE Recommendation No. 20 "Codes for Units of Measure Used in International Trade" or UNECE Recommendation No 21 "Codes for Passengers, Types of Cargo, Packages and Packaging Materials", see UNECE Code List Recommendations.VAT Category Code A code for categorizing VAT regulations, is copied from VAT Category Codeon the Tax Rules custom setting.
The code is expected to be one of the codes listed in the code list 5305 of the United Trade Data Interchange Directory (UNTDID), see UNTDID 5305 Duty or tax or fee category code. - New Fields on Business Entity
-
Field Description E-Invoice Format The target format for electronic invoices.
Currently,Peppol BIS Billing UBLandXRechnung UBLare supported.E-Invoice Sender Address The return address for replies to an issued electronic invoice.
Addresses are subject to the Electronic Address Scheme.
When creating e-invoices in the Peppol BIS Billing format or when distributing e-invoices via the Peppol network, only a limited set of address schemes is allowed.E-Invoice Sender Scheme Id The identifier that indicates the type of the used e-invoice sender address. Supporting Document Types Defines which file types will be embedded in the e-invoice XML (see Supporting Documents) - New field on Quantity Units
-
Field Description Code A code for the measurement unit applicable to the invoiced quantity, is copied to Unit Codeon the invoice line item.
The code is expected to be one of the codes listed in UNECE Recommendation No. 20 "Codes for Units of Measure Used in International Trade" or UNECE Recommendation No 21 "Codes for Passengers, Types of Cargo, Packages and Packaging Materials", see UNECE Code List Recommendations. - New field on Tax Rules
-
Field Description VAT Category Code A code for categorizing VAT regulations, is copied to VAT Category Codeon the invoice line item.
The code is expected to be one of the codes listed in the code list 5305 of the United Trade Data Interchange Directory (UNTDID), see UNTDID 5305 Duty or tax or fee category code.
E-Invoice Statuses
E-Invoice Status
The field E-Invoice Status on the invoice indicates the result of the e-invoice creation. Depending on the creation and distribution methods, the applicable statuses differ:
| Status | Description |
|---|---|
| Not created | Indicates invoices that have not been processed to create an e-invoice file. |
| Validation Error | The e-invoice validation has failed. The validation report is attached to the invoice record. |
| Created | The e-invoice has been successfully created and validated. The e-invoice XML file is attached to the invoice record. |
| Created With Warnings | The e-invoice has been successfully created, but the validation has produced warnings. The e-invoice XML file and the validation report are attached to the invoice record. |
| Status | Description |
|---|---|
| Not created | Indicates invoices that have not been processed to create an e-invoice file. |
| Validation Error | The e-invoice validation has failed. The validation report is attached to the invoice record. |
| Created | The e-invoice has been successfully created and validated. The e-invoice XML file is attached to the invoice record. |
| Created With Warnings | The e-invoice has been successfully created, but the validation has produced warnings. The e-invoice XML file and the validation report are attached to the invoice record. |
| Distribution Error | The e-invoice processing with the distribution provider has failed. Details are saved to the E-Invoice Error field on the invoice. |
| In Peppol Queue | The e-invoice has been successfully transferred to Peppol and is waiting for being processed. |
| Status | Description |
|---|---|
| Not created | Indicates invoices that have not been processed to create an e-invoice file. |
| Validation Error | The e-invoice validation has failed. The validation report is attached to the invoice record. |
| Created | The Avalara UBL XML has been successfully created and validated. The Avalara UBL XML file is attached to the invoice record. |
| Created With Warnings | The Avalara UBL XML has been successfully created, but the validation has produced warnings. The Avalara UBL XML file and the validation report are attached to the invoice record. |
| Distribution Error | The e-invoice processing with the distribution provider has failed. Details are saved to the E-Invoice Error field on the invoice. |
| In Avalara Queue | The Avalara UBL XML file has been successfully transferred to Avalara ELR and is waiting for being processed. |
| Avalara Processing Complete | Avalara ELR has successfully processed the e-invoice data, and the produced e-invoice XML file has been downloaded and attached to the invoice record. |
Info
Using the global settings option Ignore EInvoice Validation Warnings, JustOn Billing & Invoice Management will ignore validation warnings and set E-Invoice Status to Created, even if the validation has produced warnings. Consequently, no validation report will be attached to the invoice record.
E-Invoice Provider Status
The field E-Invoice Provider Status on the invoice tracks the lifecycle of the e-invoice with the distribution provider. Depending on the distribution provider, the applicable statuses differ:
| Status | Description |
|---|---|
| Queued | The e-invoice is ready to be sent to the recipient. |
| Validation Error | The e-invoice validation has failed. |
| Conversion Error | The e-invoice conversion (to a specific recipient format) has failed. |
| Send Error | Sending the e-invoice to the recipient has failed. |
| Sent | The e-invoice has been sent to the recipient. |
| Receiver Error | Receiving the e-invoice by the recipient has failed. |
| Received | The e-invoice has been received by the recipient. |
| Status | Description |
|---|---|
| Queued | The Avalara UBL XML file has been successfully transferred to Avalara ELR and is waiting for being processed. |
| Send Error | The e-invoice processing in Avalara ELR has failed. |
| Completed | The e-invoice has been successfully processed in Avalara ELR but has not been sent to the recipient. The relevant e-invoice requires additional processing in JustOn Billing & Invoice Management. |
| Sent | The e-invoice has been successfully processed in Avalara ELR and sent to the recipient via the Avalara network. |
Avalara ELR Post-Processing
For some country mandates, Avalara ELR cannot send the produced e-invoice XML files to the recipient. This includes mandates where e-invoicing flow is set to Pre-Clearance or Compliance e-Invoicing. (Find this information in the Data field of the country mandate configuration.)
In this case, JustOn Billing & Invoice Management handles the final distribution of the downloaded e-invoice XML files. There are two options:
- automatically sending the downloaded e-invoice XML files via email
- manually distributing the downloaded e-invoice XML files
For details, see Configuring Post-Processing.
E-Invoice Provider Notifications
As Avalara ELR or Peppol transfer the e-invoices to the recipients, the sender will receive notifications about the distribution status. JustOn Billing & Invoice Management stores this information in dedicated notification records, which are related to the original invoice.
These provider messages include the following information:
| Field | Description |
|---|---|
| Invoice | Links to the related invoice |
| Timestamp | Shows the notification time |
| Type | Shows the type of the notification as provided by Peppol. Possible values includeStage-Update: new processing step has startedStage-Success: processing step has successfully completedError: error on processing |
| Stage | Indicates the processing step of the invoice in the Peppol processing pipeline as provided by Peppol. Possible values include Validation, Conversion, Transmission, Reception |
| Is final | Indicates whether the Peppol processing pipeline is completed and no more notifications are expected |
| Message | Shows the key message of the notification as provided by Peppol, for example Transmission of your document was successful |
| Raw Notification | Contains the raw response (JSON string map) from Peppol |
| Field | Description |
|---|---|
| Invoice | Links to the related invoice |
| Timestamp | Shows the notification time |
| Type | Shows the type of the notification. For Avalara ELR, the type is statusChange. |
| Stage | Indicates the processing status of the invoice in Avalara ELR. Possible values includePending: e-invoice is being processedComplete: e-invoice is sentError: e-invoice processing has failed |
| Raw Notification | Contains the raw response (JSON string map) from Avalara ELR |
Supporting Document Embedding
In addition to the actual invoice data, e-invoices allow for embedding supporting documents.
JustOn Billing & Invoice Management can embed the files that are attached to invoice records, such as the produced invoice PDF, files linked from source records or files uploaded manually by users. Any type of files that is possibly to be embedded in the e-invoice XML must be defined as a content version type.
To embed attached files, you specify their content version type in the Invoice field Supporting Document Types. This field can be populated on invoice creation from other records using the following fallback mechanism:
ON_SupportingDocumentTypes from the account or invoice source record
↳ Supporting Document Types from the template
↳ Supporting Document Types from the business entity
Users can change the content version types in Supporting Document Types as long as the invoice is not finalized, that is, has the status Draft.
On e-invoice generation (during the invoice finalization or manually after finalization), JustOn Billing & Invoice Management
- retrieves all eligible files (including those attached after invoice finalization),
- converts them to plain text using Base64 encoding, and
- incorporates the encoded content in the e-invoice XML.
For details on enabling the support for embedding additional documents, see Enabling Supporting Document Embedding.
Info
Be aware of the following specifics (imposed by the e-invoice specification):
- The number of supporting documents must not exceed 200.
- The allowed file types for supporting documents include PDF, PNG, JPG, JPEG, CSV, XLSX, ODS.
- Base64 encoding causes an overhead of about one third compared to the size of the original binary data (see Base64).
- The cumulated size (Base64 encoded) must not exceed 11 MB. That is, the original attachment size must not exceed 8 MB approx.
- The overall XML size must not exceed 15 MB.
For more details, see Technische Informationen zu den Nutzungsbedingungen DE.
If you use supporting documents for both embedding in e-invoices and attaching to accounting documents, the maximum size of the produced XML file must not exceed 3,76 MB.
Plain Text for Information Texts
The invoice includes a number of text fields that can hold explanatory information related to certain invoice data. For PDF output, the text can contain HTML markup. For e-invoice XML files, however, HTML is not allowed. This is why these fields exist in two versions: one for HTML/rich text and one for plain text.
| HTML-Capable Field | Plain Text Field |
|---|---|
| Payment Info | Payment Info (Plain Text) |
| Text 1 | Text 1 (Plain Text) |
JustOn Billing & Invoice Management retrieves the texts from the corresponding template fields on invoice finalization (or when users manually copy the template text). This fills the invoice fields accordingly: the complete information, including HTML markup, is inserted in the appropriate fields, and the same information without HTML is inserted in the plain text fields.
Consequently, JustOn Billing & Invoice Management uses
- the values in the HTML-capable fields for rendering the PDF files
- the values in the plain text fields for creating the e-invoice XML files.