Welcome to Zuora Product Documentation

Explore our rich library of product information

Field mapping management for e-invoice file templates for Portugal

Manage field mapping for e-invoice file templates for Portugal, ensuring that the default mappings align with your business requirements and the Portugal implementation supported by Avalara.

Manage field mappings for e-invoice file templates used in Portugal's e-invoicing clearance process so that the generated payload contains the Portugal-specific business data required by Avalara. If the default field mapping does not align with your business requirements, you might need to customize the default template.

For the Portugal pre-integrated package, Zuora currently targets Avalara with the Clearance process and UBL as the supported outbound format. The supported download types currently identified for Portugal are XML, PDF, ZIP, and UBL_XML.

E-invoicing business regions configuration for Portugal

Configure the Portugal business region with the seller data required for Portugal e-invoicing.

  • Set Country to Portugal.

  • Select Avalara as the service provider.

  • Set the e-invoice process to Clearance.

  • Enable Invoice, Credit Memo, and Debit Memo as the supported billing document types.

Make sure the seller legal name, business identifiers, tax registration details, and address information are complete and consistent with the values configured in Avalara for the Portugal package. Use the same Portugal-specific seller data consistently across your business region configuration, service provider setup, and billing documents to help ensure successful e-invoice generation, submission, and validation.

E-invoicing profiles for accounts configuration in Portugal

Configure e-invoicing profiles for customer accounts involved in Portugal e-invoicing.

In the default templates, buyer profile data is sourced from Account.EInvoiceProfile. At a minimum, make sure the customer account is enabled for e-invoicing and that the buyer legal name and tax registration details are complete and consistent with the Portugal setup. This matches the pattern used in existing Avalara country topics, where buyer-side legal and tax data must be complete and aligned with the country package.

The following buyer-side mappings are used:

  • Buyer legal name maps to cac:AccountingCustomerParty/cac:Party/cac:PartyName/cbc:Name.

  • Buyer tax register number maps to cac:PartyTaxScheme/cbc:CompanyID with tax scheme VAT.

Sold-to contact configuration for Portugal

Configure the sold-to contact with complete Portugal address information, including address line, city, postal code, and country. Use consistent buyer contact and address data because these values are part of the data set used in template generation, submission, and validation. This follows the same guidance used in existing Avalara country-specific field-mapping topics.

In the default templates, the buyer address is populated in the following order:

  • For invoice and debit memo templates, use SoldToContactSnapshot if present.

  • If no snapshot is available, use SoldToContact.

  • If neither is available, fall back to Account.SoldTo.

  • For the credit memo template, the address falls back from SoldToContactSnapshot to Account.SoldTo.

  • The country code is emitted as PT in all cases.

Invoice template field mapping for Portugal

The default Portugal invoice template uses the UBL Invoice structure and maps the following key fields:

  • InvoiceNumber to cbc:ID.

  • InvoiceDate to cbc:IssueDate.

  • CreatedDate to cbc:IssueTime.

  • DueDate to cbc:DueDate.

  • Fixed invoice type code 380.

  • Currency to cbc:DocumentCurrencyCode.

  • The invoice period start date from the earliest ServiceStartDate across invoice items.

  • The invoice period end date from the latest ServiceEndDate across invoice items.

Credit memo template field mapping for Portugal

The default Portugal credit memo template uses the UBL CreditNote structure and maps the following key fields:

  • MemoNumber to cbc:ID.

  • MemoDate to cbc:IssueDate.

  • CreatedDate to cbc:IssueTime.

  • Fixed credit note type code 381.

  • Currency to cbc:DocumentCurrencyCode.

  • The original invoice number to cac:BillingReference/cac:CreditNoteDocumentReference/cbc:ID.

  • Fixed document type code 01 in the billing reference.

  • TotalAmount to cac:LegalMonetaryTotal/cbc:PayableAmount.

Debit memo template field mapping for Portugal

The default Portugal debit memo template uses the UBL Invoice structure for debit memo output and maps the following key fields:

  • MemoNumber to cbc:ID.

  • MemoDate to cbc:IssueDate.

  • CreatedDate to cbc:IssueTime.

  • DueDate to cbc:DueDate.

  • Fixed invoice type code 383.

  • Currency to cbc:DocumentCurrencyCode.

  • The debit memo period start date from the earliest ServiceStartDate across debit memo items.

  • The debit memo period end date from the latest ServiceEndDate across debit memo items.

  • The original invoice number to cac:BillingReference/cac:DebitNoteDocumentReference/cbc:ID.

  • Fixed document type code 01 in the billing reference.

Allowance and charge mapping for Portugal

In the invoice and debit memo templates, line items with ProcessingType = 1 are emitted as cac:AllowanceCharge entries.

The default mapping behavior is:

  • ChargeIndicator is set to true for positive values and false for negative values.

  • ChargeName maps to cbc:AllowanceChargeReason.

  • The allowance or charge amount is emitted as an absolute positive value.

  • Tax category ID is mapped to S when TaxRate > 0 and to Z when the tax rate is zero or when no taxation item is available.

  • Tax scheme is emitted as VAT.

  • Tax percentage is emitted from TaxRate * 100 and rounded to two decimal places.

Tax mapping for Portugal

The default Portugal templates use VAT-based tax mapping.

The default tax behavior is:

  • TaxAmount maps to cac:TaxTotal/cbc:TaxAmount for invoice and debit memo templates.

  • Invoice tax subtotals are grouped by TaxCode.

  • Debit memo tax subtotals are grouped by TaxCodeName.

  • For each tax subtotal, taxable amount and tax amount are calculated from the grouped line items.

  • Tax category ID is mapped to S when TaxRate > 0 and to Z when the tax rate is zero or when no taxation item is available.

  • Tax scheme is emitted as VAT.

  • Tax percentage is rounded to two decimal places.

Line-level item mapping for Portugal

For invoices and debit memos, line items with ProcessingType != 1 are emitted as document lines. For credit memos, CreditMemoItems with ProcessingType != 1 are emitted as credit note lines.

The default line-level mapping behavior is:

  • The line ID is generated sequentially.

  • ChargeName maps to the item name.

  • The line item Id maps to cac:SellersItemIdentification/cbc:ID.

  • Quantity is emitted with unit code C62.

  • When the source amount is negative, the quantity is multiplied by -1 so the generated quantity stays aligned with the document direction.

  • Line extension amount is emitted from the source charge amount or memo amount without tax.

  • Price amount is emitted as the absolute line amount when quantity is zero.

  • Otherwise, price amount is calculated as the absolute line amount divided by quantity.

  • Line-level tax category uses the same S or Z logic as the document-level tax mapping and emits tax scheme VAT.

For invoice and debit memo templates, the default legal monetary total section includes:

  • LineExtensionAmount from the sum of non-allowance lines.

  • TaxExclusiveAmount from the total amount before tax.

  • TaxInclusiveAmount from the total amount including tax.

  • AllowanceTotalAmount from the absolute total of negative allowance values.

  • ChargeTotalAmount from the total of positive allowance values.

  • PayableAmount from the total payable amount.

For the credit memo template, the default legal monetary total currently emits PayableAmount only.