Ir al contenido
Log in

Campos de factura JSON a XML UBL (EN 16931 / Peppol BIS 3.0)

Esta guía detalla el mapeo entre los campos de la API de facturas de B2Brouter, los Términos de Negocio (BT) correspondientes definidos por el estándar europeo de facturación electrónica (EN 16931) y las rutas XML del modelo UBL 2.1 (incluyendo Peppol BIS Billing 3.0).

BTTérmino de negocioCampo API (B2Brouter)UBL XPath
BT-1Número de facturainvoice.numbercbc:ID
BT-2Fecha de emisióninvoice.datecbc:IssueDate
BT-3Código de tipo de facturainvoice.type_code (api 2026-03-02)cbc:InvoiceTypeCode (o cbc:CreditNoteTypeCode)
BT-5Moneda del documentoinvoice.currencycbc:DocumentCurrencyCode
BT-6Código de moneda fiscalinvoice.contact.currencycbc:TaxCurrencyCode
BT-7Fecha del punto impositivoinvoice.tax_point_datecbc:TaxPointDate
BT-9Fecha de vencimientoinvoice.due_datecbc:DueDate
BT-10Referencia del compradorinvoice.buyer_referencecbc:BuyerReference
BT-19Referencia contableinvoice.buyer_accounting_referencecbc:AccountingCost
BT-22Nota (cabecera)invoice.extra_infocbc:Note

Notas:

  • BT-6: Solo se emite cuando la moneda del contacto comprador difiere de la moneda de la factura (BT-5) y hay importes de impuestos en dicha moneda. Cuando se establece, se renderiza un segundo bloque cac:TaxTotal con los importes en esta moneda.
BTTérmino de negocioCampo API (B2Brouter)UBL XPath
BT-13Referencia de orden de comprainvoice.ponumbercac:OrderReference/cbc:ID
BT-14Referencia de pedido de ventainvoice.sales_order_referencecac:OrderReference/cbc:SalesOrderID
BT-12Referencia de contratoinvoice.contract_numbercac:ContractDocumentReference/cbc:ID
BT-15Referencia de aviso de recepcióninvoice.receiving_advice_referencecac:ReceiptDocumentReference/cbc:ID
BT-16Referencia de aviso de despachoinvoice.delivery_note_numbercac:DespatchDocumentReference/cbc:ID
BT-25Referencia de factura anteriorinvoice.amended_numbercac:BillingReference/cac:InvoiceDocumentReference/cbc:ID
BT-26Fecha de factura anteriorinvoice.amended_datecac:BillingReference/cac:InvoiceDocumentReference/cbc:IssueDate
BT-73Inicio del período de facturacióninvoice.invoicing_period_startcac:InvoicePeriod/cbc:StartDate
BT-74Fin del período de facturacióninvoice.invoicing_period_endcac:InvoicePeriod/cbc:EndDate
BT-11Referencia de proyectoinvoice.file_referencecac:ProjectReference/cbc:ID
Referencia de documento originadorinvoice.lot_referencecac:OriginatorDocumentReference/cbc:ID

Notas:

  • Para notas de crédito, file_reference (BT-11) se emite como cac:AdditionalDocumentReference/cbc:ID en lugar de cac:ProjectReference/cbc:ID.

Este mapeo se describe para una factura emitida; si deseas mapear una factura recibida, intercambia AccountingSupplierParty y AccountingCustomerParty.

Autofacturación (IssuedSelfInvoice / ReceivedSelfInvoice): en la autofacturación el comprador emite la factura en nombre del proveedor, por lo que los roles de las partes en el XML se invierten respecto a los campos de la API. Para una IssuedSelfInvoice, los datos de account aparecen en AccountingCustomerParty (tu empresa es el comprador) y los datos de invoice.contact aparecen en AccountingSupplierParty (el contacto es el proveedor). Lo mismo aplica simétricamente a ReceivedSelfInvoice.

BTTérmino de negocioCampo API (B2Brouter)UBL XPath
BT-34ID de endpoint del vendedoraccount.pin_valuecac:AccountingSupplierParty/cac:Party/cbc:EndpointID @schemeID
BT-27Nombre legal del vendedoraccount.namecac:AccountingSupplierParty/cac:Party/cac:PartyLegalEntity/cbc:RegistrationName
BT-31NIF/IVA del vendedoraccount.tin_valuecac:AccountingSupplierParty/cac:Party/cac:PartyTaxScheme/cbc:CompanyID
BT-35Calle del vendedoraccount.addresscac:AccountingSupplierParty/cac:Party/cac:PostalAddress/cbc:StreetName
BT-36Calle 2 del vendedoraccount.address2cac:AccountingSupplierParty/cac:Party/cac:PostalAddress/cbc:AdditionalStreetName
BT-37Ciudad del vendedoraccount.citycac:AccountingSupplierParty/cac:Party/cac:PostalAddress/cbc:CityName
BT-38Código postal del vendedoraccount.postalcodecac:AccountingSupplierParty/cac:Party/cac:PostalAddress/cbc:PostalZone
BT-39Provincia del vendedoraccount.provincecac:AccountingSupplierParty/cac:Party/cac:PostalAddress/cbc:CountrySubentity
BT-40País del vendedoraccount.countrycac:AccountingSupplierParty/cac:Party/cac:PostalAddress/cac:Country/cbc:IdentificationCode
BT-41Nombre de contacto del vendedoraccount.contact_personcac:AccountingSupplierParty/cac:Party/cac:Contact/cbc:Name
BT-42Teléfono de contacto del vendedoraccount.phonecac:AccountingSupplierParty/cac:Party/cac:Contact/cbc:Telephone
BT-43Email de contacto del vendedoraccount.emailcac:AccountingSupplierParty/cac:Party/cac:Contact/cbc:ElectronicMail
BTTérmino de negocioCampo API (B2Brouter)UBL XPath
BT-49ID de endpoint del compradorinvoice.contact.pin_valuecac:AccountingCustomerParty/cac:Party/cbc:EndpointID @schemeID
BT-44Nombre legal del compradorinvoice.contact.namecac:AccountingCustomerParty/cac:Party/cac:PartyLegalEntity/cbc:RegistrationName
BT-45Nombre comercial del compradorinvoice.contact.namecac:AccountingCustomerParty/cac:Party/cac:PartyName/cbc:Name
BT-48NIF/IVA del compradorinvoice.contact.tin_valuecac:AccountingCustomerParty/cac:Party/cac:PartyTaxScheme/cbc:CompanyID
BT-50Calle del compradorinvoice.contact.addresscac:AccountingCustomerParty/cac:Party/cac:PostalAddress/cbc:StreetName
BT-51Calle 2 del compradorinvoice.contact.address2cac:AccountingCustomerParty/cac:Party/cac:PostalAddress/cbc:AdditionalStreetName
BT-52Ciudad del compradorinvoice.contact.citycac:AccountingCustomerParty/cac:Party/cac:PostalAddress/cbc:CityName
BT-53Código postal del compradorinvoice.contact.postalcodecac:AccountingCustomerParty/cac:Party/cac:PostalAddress/cbc:PostalZone
BT-54Provincia del compradorinvoice.contact.provincecac:AccountingCustomerParty/cac:Party/cac:PostalAddress/cbc:CountrySubentity
BT-55País del compradorinvoice.contact.countrycac:AccountingCustomerParty/cac:Party/cac:PostalAddress/cac:Country/cbc:IdentificationCode
BT-56Nombre de contacto del compradorinvoice.contact.contact_personcac:AccountingCustomerParty/cac:Party/cac:Contact/cbc:Name
BT-57Teléfono de contacto del compradorinvoice.contact.phonecac:AccountingCustomerParty/cac:Party/cac:Contact/cbc:Telephone
BT-58Email de contacto del compradorinvoice.contact.emailcac:AccountingCustomerParty/cac:Party/cac:Contact/cbc:ElectronicMail
BTTérmino de negocioCampo API (B2Brouter)UBL XPath
BT-72Fecha de entregainvoice.delivery_datecac:Delivery/cbc:ActualDeliveryDate
BT-71ID de ubicación de entregainvoice.delivery_location_idcac:Delivery/cac:DeliveryLocation/cbc:ID
BT-75Calle de entregainvoice.delivery_addresscac:Delivery/cac:DeliveryLocation/cac:Address/cbc:StreetName
BT-76Calle 2 de entregainvoice.delivery_address2cac:Delivery/cac:DeliveryLocation/cac:Address/cbc:AdditionalStreetName
BT-77Ciudad de entregainvoice.delivery_citycac:Delivery/cac:DeliveryLocation/cac:Address/cbc:CityName
BT-78Código postal de entregainvoice.delivery_postalcodecac:Delivery/cac:DeliveryLocation/cac:Address/cbc:PostalZone
BT-79Provincia de entregainvoice.delivery_provincecac:Delivery/cac:DeliveryLocation/cac:Address/cbc:CountrySubentity
BT-80País de entregainvoice.delivery_countrycac:Delivery/cac:DeliveryLocation/cac:Address/cac:Country/cbc:IdentificationCode
BT-70Nombre de la parte de entregainvoice.delivery_party_namecac:Delivery/cac:DeliveryParty/cac:PartyName/cbc:Name
BTTérmino de negocioCampo API (B2Brouter)UBL XPath
BT-81Código de medio de pagoinvoice.payment_methodcac:PaymentMeans/cbc:PaymentMeansCode @listID='UNCL4461'
BT-82Texto del medio de pagoinvoice.payment_method_textcac:PaymentMeans/cbc:PaymentMeansCode @name
BT-83Información de remesainvoice.remittance_informationcac:PaymentMeans/cbc:PaymentID
BT-84IBAN de cuenta bancaria del beneficiarioinvoice.bank_account.ibancac:PaymentMeans/cac:PayeeFinancialAccount/cbc:ID
BT-84-0Número de cuenta bancaria del beneficiarioinvoice.bank_account.numbercac:PaymentMeans/cac:PayeeFinancialAccount/cbc:ID (alternativo cuando no hay IBAN)
BT-85Nombre de cuenta bancaria del beneficiarioinvoice.bank_account.namecac:PaymentMeans/cac:PayeeFinancialAccount/cbc:Name (actualmente no se renderiza)
BT-86BIC de cuenta bancaria del beneficiarioinvoice.bank_account.biccac:PaymentMeans/cac:PayeeFinancialAccount/cac:FinancialInstitutionBranch/cbc:ID
BT-87Número de cuenta de tarjetainvoice.card_account_attributes.account_numbercac:PaymentMeans/cac:CardAccount/cbc:PrimaryAccountNumberID
BT-87-0Nombre del titular de la tarjetainvoice.card_account_attributes.holder_namecac:PaymentMeans/cac:CardAccount/cbc:HolderName
BT-88ID de red de tarjetainvoice.card_account_attributes.networkcac:PaymentMeans/cac:CardAccount/cbc:NetworkID
BT-20Condiciones de pagoinvoice.payment_termscac:PaymentTerms/cbc:Note
BT-89Referencia de mandato (solo SEPA DD)invoice.mandate_reference_identifiercac:PaymentMeans/cac:PaymentMandate/cbc:ID
BT-90Referencia del acreedor (SEPA DD)invoice.bank_assigned_creditor_referencecac:AccountingSupplierParty/cac:Party/cac:PartyIdentification/cbc:ID @schemeID='SEPA'
BT-91IBAN de cuenta del deudor (SEPA DD)invoice.contact_ibancac:PaymentMeans/cac:PaymentMandate/cac:PayerFinancialAccount/cbc:ID
BTTérmino de negocioCampo API (B2Brouter)UBL XPath
BT-106Total importes netos de líneas(calculado)cac:LegalMonetaryTotal/cbc:LineExtensionAmount
BT-109Importe sin impuestos(calculado)cac:LegalMonetaryTotal/cbc:TaxExclusiveAmount
BT-107Total importes de descuentos(calculado)cac:LegalMonetaryTotal/cbc:AllowanceTotalAmount
BT-108Total importes de cargos(calculado)cac:LegalMonetaryTotal/cbc:ChargeTotalAmount
BT-112Importe con impuestos(calculado)cac:LegalMonetaryTotal/cbc:TaxInclusiveAmount
BT-113Total importe prepagadoinvoice.payments_on_accountcac:LegalMonetaryTotal/cbc:PrepaidAmount
BT-114Importe de redondeo(del ajuste de factura)cac:LegalMonetaryTotal/cbc:PayableRoundingAmount
BT-115Importe pendiente de pagoinvoice.payable_amountcac:LegalMonetaryTotal/cbc:PayableAmount
BT-110Importe total de IVA(calculado)cac:TaxTotal/cbc:TaxAmount
BT-116Base imponible por categoría(calculado de las líneas)cac:TaxTotal/cac:TaxSubtotal/cbc:TaxableAmount
BT-117Importe de IVA por categoría(calculado de las líneas)cac:TaxTotal/cac:TaxSubtotal/cbc:TaxAmount
Importe retenidoinvoice.withheld_percentcac:AllowanceCharge/cbc:Amount
Motivo de retencióninvoice.amounts_withheld_reasoncac:AllowanceCharge/cbc:AllowanceChargeReason
BTTérmino de negocioCampo API (B2Brouter)UBL XPath
BT-92Importe del descuentoallowance_charges_attributes[]{allowance_charge_indicator: "allowance", amount: X}cac:AllowanceCharge[cbc:ChargeIndicator=false]/cbc:Amount
BT-93Importe base del descuento(calculado cuando es porcentual)cac:AllowanceCharge[cbc:ChargeIndicator=false]/cbc:BaseAmount
BT-94Porcentaje del descuentoallowance_charges_attributes[]{allowance_charge_indicator: "allowance", percentage: X}cac:AllowanceCharge[cbc:ChargeIndicator=false]/cbc:MultiplierFactorNumeric
BT-97Motivo del descuentoallowance_charges_attributes[]{allowance_charge_indicator: "allowance", description: "..."}cac:AllowanceCharge[cbc:ChargeIndicator=false]/cbc:AllowanceChargeReason
BT-99Importe del cargoallowance_charges_attributes[]{allowance_charge_indicator: "charge", amount: X}cac:AllowanceCharge[cbc:ChargeIndicator=true]/cbc:Amount
BT-100Importe base del cargo(calculado cuando es porcentual)cac:AllowanceCharge[cbc:ChargeIndicator=true]/cbc:BaseAmount
BT-101Porcentaje del cargoallowance_charges_attributes[]{allowance_charge_indicator: "charge", percentage: X}cac:AllowanceCharge[cbc:ChargeIndicator=true]/cbc:MultiplierFactorNumeric
BT-104Motivo del cargoallowance_charges_attributes[]{allowance_charge_indicator: "charge", description: "..."}cac:AllowanceCharge[cbc:ChargeIndicator=true]/cbc:AllowanceChargeReason
BT-102Aplicar impuesto al descuento/cargoallowance_charges_attributes[]{apply_taxes: true}cac:AllowanceCharge/cac:TaxCategory

Todos los atributos siguientes son propiedades de objetos en: invoice.invoice_lines_attributes[].

BTTérmino de negocioCampo API (línea)UBL XPath
BT-126ID de línea de facturapositioncac:InvoiceLine/cbc:ID
BT-129Cantidad facturadaquantitycac:InvoiceLine/cbc:InvoicedQuantity
BT-130Cantidad facturada (unidad)unitcac:InvoiceLine/cbc:InvoicedQuantity @unitCode
BT-131Importe de extensión de líneaextension_amount (o calculado)cac:InvoiceLine/cbc:LineExtensionAmount
BT-146Precio unitariopricecac:InvoiceLine/cac:Price/cbc:PriceAmount
BT-153Nombre del artículodescriptioncac:InvoiceLine/cac:Item/cbc:Name
BT-154Descripción del artículonotescac:InvoiceLine/cac:Item/cbc:Description
BT-155ID del artículo del vendedorarticle_codecac:InvoiceLine/cac:Item/cac:SellersItemIdentification/cbc:ID
BT-156ID del artículo del compradorarticle_code_buyercac:InvoiceLine/cac:Item/cac:BuyersItemIdentification/cbc:ID
BT-157ID estándar del artículoarticle_code2cac:InvoiceLine/cac:Item/cac:StandardItemIdentification/cbc:ID @schemeID
BT-157-1Esquema del ID estándar del artículoarticle_code2_schemecac:InvoiceLine/cac:Item/cac:StandardItemIdentification/cbc:ID @schemeID (por defecto 0160)
BT-158Código de clasificaciónclassification_codecac:InvoiceLine/cac:Item/cac:CommodityClassification/cbc:ItemClassificationCode @listID
BT-158-1Esquema de código de clasificaciónclassification_code_schemecac:InvoiceLine/cac:Item/cac:CommodityClassification/cbc:ItemClassificationCode @listID
BT-151Categoría IVA (por línea)taxes_attributes[].categorycac:InvoiceLine/cac:Item/cac:ClassifiedTaxCategory/cbc:ID
BT-152Porcentaje IVA (por línea)taxes_attributes[].percentcac:InvoiceLine/cac:Item/cac:ClassifiedTaxCategory/cbc:Percent
BT-120Motivo de exención fiscaltaxes_attributes[].commentcac:InvoiceLine/cac:Item/cac:ClassifiedTaxCategory/cbc:TaxExemptionReason
BT-160Nombre de propiedad adicionaladditional_item_properties_attributes[].namecac:InvoiceLine/cac:Item/cac:AdditionalItemProperty/cbc:Name
BT-161Valor de propiedad adicionaladditional_item_properties_attributes[].valuecac:InvoiceLine/cac:Item/cac:AdditionalItemProperty/cbc:Value
BT-133Referencia contable del compradorcontact_referencecac:InvoiceLine/cbc:AccountingCost
BT-134Inicio del período de facturación de líneainvoicing_period_startcac:InvoiceLine/cac:InvoicePeriod/cbc:StartDate
BT-135Fin del período de facturación de líneainvoicing_period_endcac:InvoiceLine/cac:InvoicePeriod/cbc:EndDate
BT-136Importe del descuento de líneaallowance_charges_attributes[]{allowance_charge_indicator: "allowance", amount: X}cac:InvoiceLine/cac:AllowanceCharge[cbc:ChargeIndicator=false]/cbc:Amount
BT-138Porcentaje del descuento de líneaallowance_charges_attributes[]{allowance_charge_indicator: "allowance", percentage: X}cac:InvoiceLine/cac:AllowanceCharge[cbc:ChargeIndicator=false]/cbc:MultiplierFactorNumeric
BT-139Motivo del descuento de líneaallowance_charges_attributes[]{allowance_charge_indicator: "allowance", description: "..."}cac:InvoiceLine/cac:AllowanceCharge[cbc:ChargeIndicator=false]/cbc:AllowanceChargeReason
BT-141Importe del cargo de líneaallowance_charges_attributes[]{allowance_charge_indicator: "charge", amount: X}cac:InvoiceLine/cac:AllowanceCharge[cbc:ChargeIndicator=true]/cbc:Amount
BT-143Porcentaje del cargo de líneaallowance_charges_attributes[]{allowance_charge_indicator: "charge", percentage: X}cac:InvoiceLine/cac:AllowanceCharge[cbc:ChargeIndicator=true]/cbc:MultiplierFactorNumeric
BT-144Motivo del cargo de líneaallowance_charges_attributes[]{allowance_charge_indicator: "charge", description: "..."}cac:InvoiceLine/cac:AllowanceCharge[cbc:ChargeIndicator=true]/cbc:AllowanceChargeReason
BT-128Referencia de orden de compra (línea)invoice_lines_attributes[].ponumbercac:InvoiceLine/cac:DocumentReference/cbc:ID
BT-132Referencia de línea de POinvoice_lines_attributes[].sequence_numbercac:InvoiceLine/cac:OrderLineReference/cbc:LineID