# PEPPOL-EN16931-R130 Price base unit code must match invoiced quantity unit code

Under Peppol rule PEPPOL-EN16931-R130, whenever an invoice line specifies an item price base quantity unit of measure code in BT-150 (unitCode on BaseQuantity), its value must be identical to the invoiced quantity unit of measure code in BT-130 (unitCode on InvoicedQuantity). In electronic trade, mixing different units of measure on the same line (such as billing quantity in "H87" pieces while pricing in "KGM" kilograms without conversion) creates ambiguity in automated pricing calculations. Both unitCode attributes must share the same UN/ECE Rec 20 / Rec 21 code.

## Problem Description

> **ERROR**: Peppol BIS Billing 3.0 rule (OpenPeppol)

## Context and Significance

PEPPOL-EN16931-R130 only runs when cbc:BaseQuantity is present and compares its unitCode with the unitCode of the invoiced quantity. Different units on one line make the unit price calculation ambiguous, for example a quantity in hours priced per piece. The error usually appears when the price list stores a different unit than the order line, or when a default unit such as C62 is written into BaseQuantity.

## Solution

In your ERP product catalog or unit conversion settings, align the unit of the price base quantity (BT-150) with the line billing unit (BT-130). In UBL 2.1, make sure <cbc:BaseQuantity unitCode="H87"> carries exactly the same unitCode attribute as <cbc:InvoicedQuantity unitCode="H87">. If the price applies to one unit, you may omit cbc:BaseQuantity entirely.

- [Validate XML](/en/xrechnung-validator?source=resource&rule=PEPPOL-EN16931-R130)
- [Convert invoice](/en/pdf-to-xrechnung?source=resource&rule=PEPPOL-EN16931-R130)

## Valid Examples

- InvoicedQuantity unitCode = "H87" (piece) and BaseQuantity unitCode = "H87" (piece)
- InvoicedQuantity unitCode = "HUR" (hour) and BaseQuantity unitCode = "HUR" (hour)

## Invalid Examples

- InvoicedQuantity specified in "HUR" (hours) while Price BaseQuantity specifies unitCode = "C62" (one)
- InvoicedQuantity specified in "KGM" (kilograms) while Price BaseQuantity specifies unitCode = "LTR" (liters)

## Code Examples

### Valid XML
```
<cac:InvoiceLine>
  <cbc:ID>1</cbc:ID>
  <cbc:InvoicedQuantity unitCode="H87">100</cbc:InvoicedQuantity>
  <cac:Price>
    <cbc:PriceAmount currencyID="EUR">50.00</cbc:PriceAmount>
    <cbc:BaseQuantity unitCode="H87">100</cbc:BaseQuantity>
  </cac:Price>
</cac:InvoiceLine>
```

### Invalid XML
```
<cac:InvoiceLine>
  <cbc:ID>1</cbc:ID>
  <cbc:InvoicedQuantity unitCode="H87">100</cbc:InvoicedQuantity>
  <cac:Price>
    <cbc:PriceAmount currencyID="EUR">50.00</cbc:PriceAmount>
    <cbc:BaseQuantity unitCode="C62">100</cbc:BaseQuantity>
  </cac:Price>
</cac:InvoiceLine>
```

## Affected Fields

- [BT-130 Invoiced quantity unit of measure code](/resources/xrechnung/bt-130-invoice-line-quantity-unit-of-measure-code)
- [BT-150 Item price base quantity unit of measure code](/resources/xrechnung/bt-150-item-price-base-quantity-unit-code)
- [BG-25 Invoice line](/resources/xrechnung/bt-126-invoice-line-identifier)

## Related Rules

- [BR-23](/resources/kosit-validator-errors/br-23-invoice-line-unit-code-must-be-present)
- [BR-26](/resources/kosit-validator-errors/br-26-invoice-line-item-net-price-must-be-present)
- [PEPPOL-EN16931-R120](/resources/kosit-validator-errors/peppol-en16931-r120-line-net-amount-formula)

## Validation Tools

- [Official KoSIT Validator](https://github.com/itplr-kosit/validator): Run the official KoSIT validator with the XRechnung configuration to check EN 16931 and XRechnung rules.
- [Convert PDF to XRechnung](/pdf-to-xrechnung): Find validation errors during conversion and review each correction.

## Related Resources

- [Official Specification](https://docs.peppol.eu/poacc/billing/3.0/rules/ubl-peppol/)
- [Test Suite](https://github.com/itplr-kosit/xrechnung-testsuite)
- [All validation errors](/resources/kosit-validator-errors): Overview of the EN 16931, XRechnung and Peppol validation rules explained here.
