<?xml version="1.0" encoding="UTF-8"?>
<!--
  ═══════════════════════════════════════════════════════════════════════════
  invoice-ubl21-en.xml — working sample document for the sandbox environment
  sandbox.earhiva.mk (T-24.2.3-021 · AC-24.2.3-35).

  The document content is in English. Use it when the organisation you are testing in
  has a default language other than Macedonian; for a Macedonian one, use
  invoice-ubl21.xml instead. Only the content differs — the structure is identical.

  This file is ACCEPTED as is: save it in the folder you run the Quick Start
  step 3 command from, send it unchanged, and the answer is 201 with a docUid.

  It goes ALL THE WAY to the tax authority and is refused there — that is expected,
  and it is the only thing left standing in your way. Measured on the sandbox server
  (13.09.2026): status 250 with EARH-4002 and ujp.code E1000, "Company NOT Found!:
  buyer". The recipient below (4030000000000) is a made-up value in a valid shape,
  so the tax authority does not know it. Put the tax number of a real company and
  the path is clear.

  NOTE ON THE SENDER: the supplier block carries only a name, on purpose. The sender
  is resolved from the API key, and the tax number, the VAT number and the address
  of the issuer are filled in from your organization — you do not have to write them
  here. If you DO write an issuer tax number, it must be your own organization's;
  another one is refused in the same call with EARH-2007.

  REPLACE ONLY THIS
      cac:AccountingSupplierParty  — the sender: the company you send on behalf of
      cac:AccountingCustomerParty  — the recipient: name, tax number and address
      cbc:ID                       — your document number
      cbc:IssueDate                — the issue date
      the amounts and the line     — if you want a different total; keep the VAT rate
                                     (cbc:Percent) consistent with cac:TaxTotal

  DO NOT CHANGE
      the three xmlns declarations on the root, and the `Invoice` root itself
      the element names and their order
      `cbc:InvoiceTypeCode` — 380 is an invoice
      the path to the recipient's tax number
      the path to `cbc:PayableAmount` and its `currencyID`

  Validates against `ubl21-earhiva.xsd` (the schema and its two companion files
  are downloaded from the Formats page, into the same folder).
  ═══════════════════════════════════════════════════════════════════════════
-->
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2"
         xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
         xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">

  <cbc:ID>0001/2026</cbc:ID>
  <cbc:IssueDate>2026-08-25</cbc:IssueDate>
  <cbc:DueDate>2026-09-24</cbc:DueDate>

  <!-- 380 = invoice. For a credit note the root is CreditNote, and this element
       becomes cbc:CreditNoteTypeCode. -->
  <cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode>

  <cbc:DocumentCurrencyCode>MKD</cbc:DocumentCurrencyCode>

  <!-- REPLACE: your own sender details.
       The sender is identified by the API key, so NO tax number is carried here.

       If you do add cac:PartyTaxScheme/cbc:CompanyID, it must be the tax number of
       the organization the key belongs to — another one is refused with EARH-2007 in
       the same call. A placeholder value therefore cannot be left in a working
       sample, which is why this block carries only a name. -->
  <cac:AccountingSupplierParty>
    <cac:Party>
      <cac:PartyName>
        <cbc:Name>Your company name</cbc:Name>
      </cac:PartyName>
    </cac:Party>
  </cac:AccountingSupplierParty>

  <!-- The recipient. The tax number is required and must be well-formed —
       thirteen digits, with or without a two-letter country prefix. Whether the
       recipient exists is not checked on acceptance.
       The address is not checked on acceptance either, but UJP requires the street,
       city and postal code — without them the invoice stops before UJP (EARH-4001). -->
  <cac:AccountingCustomerParty>
    <cac:Party>
      <cac:PartyName>
        <cbc:Name>Demo recipient</cbc:Name>
      </cac:PartyName>
      <cac:PostalAddress>
        <cbc:StreetName>Sample street 1</cbc:StreetName>
        <cbc:CityName>Skopje</cbc:CityName>
        <cbc:PostalZone>1000</cbc:PostalZone>
        <cac:Country>
          <cbc:IdentificationCode>MK</cbc:IdentificationCode>
        </cac:Country>
      </cac:PostalAddress>
      <cac:PartyTaxScheme>
        <cbc:CompanyID>4030000000000</cbc:CompanyID>
      </cac:PartyTaxScheme>
    </cac:Party>
  </cac:AccountingCustomerParty>

  <cac:TaxTotal>
    <cbc:TaxAmount currencyID="MKD">180.00</cbc:TaxAmount>
  </cac:TaxTotal>

  <cac:LegalMonetaryTotal>
    <cbc:LineExtensionAmount currencyID="MKD">1000.00</cbc:LineExtensionAmount>
    <cbc:TaxExclusiveAmount currencyID="MKD">1000.00</cbc:TaxExclusiveAmount>
    <cbc:TaxInclusiveAmount currencyID="MKD">1180.00</cbc:TaxInclusiveAmount>
    <cbc:PayableAmount currencyID="MKD">1180.00</cbc:PayableAmount>
  </cac:LegalMonetaryTotal>

  <cac:InvoiceLine>
    <cbc:ID>1</cbc:ID>
    <cbc:InvoicedQuantity unitCode="C62">1</cbc:InvoicedQuantity>
    <cbc:LineExtensionAmount currencyID="MKD">1000.00</cbc:LineExtensionAmount>
    <cac:Item>
      <cbc:Name>Service per contract</cbc:Name>
      <!-- The line's VAT rate in percent. The tax group and indicator for UJP are
           derived from it; without it the line goes at 0 % and the VAT total no longer
           matches cac:TaxTotal (EARH-4001). -->
      <cac:ClassifiedTaxCategory>
        <cbc:ID>S</cbc:ID>
        <cbc:Percent>18</cbc:Percent>
        <cac:TaxScheme>
          <cbc:ID>VAT</cbc:ID>
        </cac:TaxScheme>
      </cac:ClassifiedTaxCategory>
    </cac:Item>
    <cac:Price>
      <cbc:PriceAmount currencyID="MKD">1000.00</cbc:PriceAmount>
    </cac:Price>
  </cac:InvoiceLine>

</Invoice>
