# Credit note

To improve readability, maintain consistency, and enhance interoperability, we
use the UBL 2.4 CreditNote schema to represent credit notes and cancel invoices
(complete invoice reversals). The CreditNote schema uses mostly the same fields
as the Invoice schema. This section indicates the dedicated elements for credit
memos and cancellations.

## 1.0 Credit note type code

Identifier of the document type. We use 381 to represent Credit Note and Cancel
Invoice.

| **Path** | **Description** | **Example** |
|---|---|---|
| **cbc:CreditNoteTypeCode** | Type of the invoice. Supported values: 381 for Credit Note, 381 for Cancel Invoice | 381 |

**Example**

    <CreditNote>
      ...
      <cbc:CreditNoteTypeCode>381</cbc:CreditNoteTypeCode>
      ...
    </CreditNote>

## 2.0 Invoice document reference

The BillingReference/InvoiceDocumentReference section provides information
related to the original invoice for invoice memos and cancellations. This
element is repeated when several invoice references are present (e.g., Google
commercial invoice ID, vendor generated ID, tax authority generated reference).
The attribute schemeID is used to identify the invoice issuer.

| **Path** | **Description** | **Example** |
|---|---|---|
| **cbc:ID** | Preceding invoice number - Identifier of a previously issued invoice | GCEMEAD000000099 |
| **cbc:ID @schemeID** | Identifier of the type of the invoice issuer | Google, Vendor, local tax authority |
| **cbc:IssueDate** | Issue date - Issue date of the previously issued invoice. The format is "YYYY-MM-DD" | 2023-05-28 |

    <CreditNote>
      ...
      <cac:BillingReference>
        <cac:InvoiceDocumentReference>
          <cbc:ID schemeID="Google">GCEMEAD000000099</cbc:ID>
          <cbc:IssueDate>2023-05-28</cbc:IssueDate>
        </cac:InvoiceDocumentReference>
      </cac:BillingReference>
      ...
    </CreditNote>

## 3.0 Credit note line items

Line items are individual goods or services enumerated in the credit note. The
schema supports one or multiple credit note line items per credit note document.

### 3.1 cac:CreditNoteLine

This section details each item or service for which a credit is issued,
including unique identifiers, credited quantities, and unit prices. It provides
a complete breakdown of the amounts before taxes associated with each credited
line item.

| **Path** | **Description** | **Example** |
|---|---|---|
| **cbc:ID** | Unique identifier for this line item; for an aggregated line item invoice the value is 1 | 1 |
| **cbc:CreditedQuantity** | Quantity of the item credited; for an aggregated line item the value is 1 | 1 |
| **cbc:LineExtensionAmount @currencyID** | Total amount for the line item in the original currency, excluding taxes | 1000 |
| **cac:Item/cbc:Name** | Name of the item | Google Cloud |
| **cac:Price/cbc:PriceAmount @currencyID** | Unit price of the item in the original currency | 1000 |

    <CreditNote>
      ...
      <cac:CreditNoteLine>
        <cbc:ID>1</cbc:ID>
        <cbc:CreditedQuantity>1</cbc:CreditedQuantity>
        <cbc:LineExtensionAmount currencyID="USD">1000</cbc:LineExtensionAmount>
        <cac:Item>
          <cbc:Name>Google Cloud</cbc:Name>
        </cac:Item>
        <cac:Price>
          <cbc:PriceAmount currencyID="USD">1000</cbc:PriceAmount>
        </cac:Price>
      </cac:CreditNoteLine>
      ...
    </CreditNote>

### 3.2 cac:CreditNoteLine/cac:TaxTotal

This section contains the total tax amount for the line item, as well as the
taxable amount, tax amount, and tax category.

| **Path** | **Description** | **Example** |
|---|---|---|
| **cbc:TaxAmount @currencyID** | Total tax amount in the original currency for the line item | 70 |
| **cac:TaxSubtotal/cbc:TaxableAmount @currencyID** | Taxable amount in the original currency for the line item | 1000 |
| **cac:TaxSubtotal/cbc:TaxAmount @currencyID** | Tax amount in the original currency for the line item | 70 |
| **cac:TaxSubtotal/cac:TaxCategory/cbc:Percent** | Tax rate applied to the line item | 7.00 |
| **cac:TaxSubtotal/cac:TaxCategory/cac:TaxScheme/cbc:ID** | Type of tax for this subtotal | VAT |

    <CreditNote>
      ...
      <cac:CreditNoteLine>
        ...
        <cac:TaxTotal>
          <cbc:TaxAmount currencyID="USD">70</cbc:TaxAmount>
          <cac:TaxSubtotal>
            <cbc:TaxableAmount currencyID="USD">1000</cbc:TaxableAmount>
            <cbc:TaxAmount currencyID="USD">70</cbc:TaxAmount>
            <cac:TaxCategory>
              <cbc:Percent>7.00</cbc:Percent>
              <cac:TaxScheme>
                <cbc:ID>VAT</cbc:ID>
              </cac:TaxScheme>
            </cac:TaxCategory>
          </cac:TaxSubtotal>
        </cac:TaxTotal>
      </cac:CreditNoteLine>
      ...
    </CreditNote>