Systems and JoFotara

JoFotara API integration: a guide for developers

How an invoice travels from your system to JoFotara and back: the credentials, the UBL 2.1 file, the request, the reply, returns and the errors that stop invoices.

Updated 10 min read

The 30 second answer

The JoFotara API takes one invoice per request. Your system writes the invoice as a UBL 2.1 XML file, encodes it in Base64 and posts it as JSON to https://backend.jofotara.gov.jo/core/invoices/ with two headers, Client-Id and Secret-Key.

More detail

If the invoice passes, the reply says SUBMITTED and carries the QR code that must be printed on the invoice. This guide follows version 1.5 of the technical guide from the Income and Sales Tax Department (ISTD), approved in May 2026, and the working integration we built for Ghalleh. If you would rather have the connection built for you, that is our JoFotara integration service.

Where the official documentation is

ISTD publishes the developer documentation in Arabic, as the technical guide for linking with the national invoicing system through the API. It is on ISTD's guides page for the national invoicing system, or you can download the technical guide as a PDF. Registration and linking happen on the JoFotara portal. Where this page and the official guide differ, the guide wins. The element names come from the UBL 2.1 standard.

The flow from sale to QR code

  1. Create the credentials. On the portal, the taxpayer opens device linking, adds a new link, types a user name and picks the income source sequence. The system generates a client ID and a secret key for that link.
  2. Build the XML. Write the invoice as UBL 2.1, with the invoice type that matches the taxpayer's registration.
  3. Encode and wrap. Encode the XML file in Base64 and put it in a JSON body under the key invoice. Only the XML is encoded, not the JSON around it.
  4. Send and read. POST the JSON with the two credential headers, then check the HTTP status and EINV_STATUS.
  5. Store and print. Save the ID, UUID, QR code and status with the invoice, and print the QR code on it.

There is no signing on your side. The national system signs the invoice and returns the signed copy in EINV_SINGED_INVOICE, a field name spelled that way in the API.

Credentials and who answers for them

Each client ID and secret key is created for one income source sequence, the number of the activity the invoices belong to. ISTD's guide makes their confidentiality the taxpayer's responsibility, including any use the taxpayer did not authorise. So the business creates the keys in its own account, they live in the software's protected settings and never in source code, logs or support chats, and they are regenerated when staff or vendors change. Not sure which registration and sequence you have? Our JoFotara readiness check asks six questions and points to the right route.

Pick the invoice type before you write any XML

Two parts of cbc:InvoiceTypeCode set the type. Its value is 388 for a new invoice and 381 for a return. Its name attribute is a three digit code: the first digit is the kind of sale, the second is cash or credit, and the third is the taxpayer's registration.

RegistrationThird digitLocal sale, cashLocal sale, on credit
Not registered for sales tax (income invoice)1011021
Registered for general sales tax2012022
Registered for special sales tax3013023

The first digit is 0 for a local sale, 1 for export, 2 for development zones, 3 for transit, 4 for foreign trade and 5 for a transfer inside the free zones, so a general sales tax invoice for a credit sale in transit is 322. On sales tax invoices of those five kinds, every line carries a 0% rate with tax category O. Development zone invoices also need the buyer's tax number, registered in the zone with a valid exemption letter.

The type follows the registration, never the cashier's choice. In our builds the registration is saved once in the settings and the code is worked out from it.

The XML, element by element

The file starts with the XML declaration and the Invoice root with its UBL namespaces, written on a single line, then cbc:ProfileID with the value reporting:1.0.

ElementWhat goes inRule
cbc:IDYour invoice numberWith the UUID, the key that stops duplicates
cbc:UUIDA unique ID your system generatesStore it before sending, reuse it on retries
cbc:IssueDateThe invoice dateFormat yyyy-mm-dd
cbc:DocumentCurrencyCodeJOD, or another currency on ISTD's listOne currency for the whole invoice
ICV in cac:AdditionalDocumentReferenceThe invoice counterStarts at 1 and counts up
cac:AccountingSupplierPartySeller tax number and registered nameMust match ISTD records
cac:AccountingCustomerPartyBuyer ID, name, postal code, governorate, phoneName required on credit invoices and on cash invoices above 10,000 JOD
cac:SellerSupplierPartyThe income source sequenceOn every invoice
cac:InvoiceLineOne element per itemEach line ID unique within the invoice

The buyer's identifier takes a schemeID: NIN for a Jordanian national number, PN for the personal number of a non-Jordanian, TN for a tax number. The postal code takes at most 5 digits, the phone 9 to 14, and governorates use codes such as JO-AM for Amman and JO-IR for Irbid. A minimal local cash invoice from a business registered for general sales tax, with sample values:

<?xml version="1.0" encoding="UTF-8"?>
<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" xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2">
  <cbc:ProfileID>reporting:1.0</cbc:ProfileID>
  <cbc:ID>INV-1001</cbc:ID>
  <cbc:UUID>3f6c1b2e-8a4d-4c9e-b7a1-2d5e9f0c4a18</cbc:UUID>
  <cbc:IssueDate>2026-10-20</cbc:IssueDate>
  <cbc:InvoiceTypeCode name="012">388</cbc:InvoiceTypeCode>
  <cbc:DocumentCurrencyCode>JOD</cbc:DocumentCurrencyCode>
  <cbc:TaxCurrencyCode>JOD</cbc:TaxCurrencyCode>
  <cac:AdditionalDocumentReference>
    <cbc:ID>ICV</cbc:ID>
    <cbc:UUID>1001</cbc:UUID>
  </cac:AdditionalDocumentReference>
  <cac:AccountingSupplierParty>
    <cac:Party>
      <cac:PostalAddress>
        <cac:Country><cbc:IdentificationCode>JO</cbc:IdentificationCode></cac:Country>
      </cac:PostalAddress>
      <cac:PartyTaxScheme>
        <cbc:CompanyID>12345678</cbc:CompanyID>
        <cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme>
      </cac:PartyTaxScheme>
      <cac:PartyLegalEntity>
        <cbc:RegistrationName>Sample Store</cbc:RegistrationName>
      </cac:PartyLegalEntity>
    </cac:Party>
  </cac:AccountingSupplierParty>
  <cac:AccountingCustomerParty>
    <cac:Party>
      <cac:PostalAddress>
        <cac:Country><cbc:IdentificationCode>JO</cbc:IdentificationCode></cac:Country>
      </cac:PostalAddress>
      <cac:PartyTaxScheme>
        <cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme>
      </cac:PartyTaxScheme>
      <cac:PartyLegalEntity>
        <cbc:RegistrationName>Cash customer</cbc:RegistrationName>
      </cac:PartyLegalEntity>
    </cac:Party>
  </cac:AccountingCustomerParty>
  <cac:SellerSupplierParty>
    <cac:Party>
      <cac:PartyIdentification><cbc:ID>1234567</cbc:ID></cac:PartyIdentification>
    </cac:Party>
  </cac:SellerSupplierParty>
  <cac:TaxTotal>
    <cbc:TaxAmount currencyID="JO">1.600</cbc:TaxAmount>
  </cac:TaxTotal>
  <cac:LegalMonetaryTotal>
    <cbc:TaxExclusiveAmount currencyID="JO">10.000</cbc:TaxExclusiveAmount>
    <cbc:TaxInclusiveAmount currencyID="JO">11.600</cbc:TaxInclusiveAmount>
    <cbc:AllowanceTotalAmount currencyID="JO">0.000</cbc:AllowanceTotalAmount>
    <cbc:PayableAmount currencyID="JO">11.600</cbc:PayableAmount>
  </cac:LegalMonetaryTotal>
  <cac:InvoiceLine>
    <cbc:ID>1</cbc:ID>
    <cbc:InvoicedQuantity unitCode="PCE">2.000</cbc:InvoicedQuantity>
    <cbc:LineExtensionAmount currencyID="JO">10.000</cbc:LineExtensionAmount>
    <cac:TaxTotal>
      <cbc:TaxAmount currencyID="JO">1.600</cbc:TaxAmount>
      <cbc:RoundingAmount currencyID="JO">11.600</cbc:RoundingAmount>
      <cac:TaxSubtotal>
        <cbc:TaxAmount currencyID="JO">1.600</cbc:TaxAmount>
        <cac:TaxCategory>
          <cbc:ID schemeAgencyID="6" schemeID="UN/ECE 5305">S</cbc:ID>
          <cbc:Percent>16</cbc:Percent>
          <cac:TaxScheme>
            <cbc:ID schemeAgencyID="6" schemeID="UN/ECE 5153">VAT</cbc:ID>
          </cac:TaxScheme>
        </cac:TaxCategory>
      </cac:TaxSubtotal>
    </cac:TaxTotal>
    <cac:Item><cbc:Name>Sample item</cbc:Name></cac:Item>
    <cac:Price>
      <cbc:PriceAmount currencyID="JO">5.000</cbc:PriceAmount>
      <cac:AllowanceCharge>
        <cbc:ChargeIndicator>false</cbc:ChargeIndicator>
        <cbc:AllowanceChargeReason>DISCOUNT</cbc:AllowanceChargeReason>
        <cbc:Amount currencyID="JO">0.000</cbc:Amount>
      </cac:AllowanceCharge>
    </cac:Price>
  </cac:InvoiceLine>
</Invoice>

Totals, rounding and discounts

Most refusals we met were arithmetic. The guide defines every total from the lines, so calculate them in this order:

FieldHow it is calculated
LineExtensionAmountQuantity times unit price, minus the line discount
TaxAmount on a lineThe line amount times the line's tax rate
RoundingAmountThe line amount plus the line tax
TaxExclusiveAmountQuantity times unit price for all lines, before discounts
AllowanceTotalAmountThe sum of the line discounts
TaxInclusiveAmount and PayableAmountThe sum of every line's RoundingAmount

Amounts carry up to 9 decimals, and the guide allows rounding to 3 as long as each difference stays within 0.001. Quantities and unit prices must be above zero, discounts are positive, and in the official examples amounts carry currencyID="JO". JoFotara does not accept a discount on the whole invoice, so spread it across the lines first.

Shops usually price with tax included. Take the tax out of each line price, keep the full precision, and check that the invoice total equals what the customer paid, to the fils. Early rounding caused the small differences we fixed in Ghalleh. Businesses registered for sales tax can also ask ISTD to enable a consumer price mechanism, which adds an ItemPriceExtension amount to every line of the invoice.

Tax categories and rates

CategoryUse it forRate
SA taxed itemAn approved rate: 1, 2, 3, 4, 5, 7, 8, 10 or 16%
ZAn exempt item0%
OA zero rated item, and every line on export, development zone, transit, foreign trade and free zone sales invoices0%

A rate that is not on ISTD's list returns HTTP 500. Income invoices have no tax lines at all.

The request

Send each invoice as one HTTPS POST. The body is JSON with a single key, and its value is the Base64 text of the XML file:

POST /core/invoices/ HTTP/1.1
Host: backend.jofotara.gov.jo
Client-Id: <client ID from the portal>
Secret-Key: <secret key from the portal>
Content-Type: application/json

{"invoice": "<the XML file, Base64 encoded>"}

The C# sample in the guide also sets a Cookie header with a fixed value. Our integration sends only the three headers above and its invoices pass, so there is no need to copy it.

Reading the reply

An HTTP 200 only means the request arrived and was processed. Whether the invoice was accepted is in EINV_STATUS.

HTTP statusMeaning
200Processed. Read EINV_STATUS for the result
400A value in the XML is wrong. The reason is in EINV_MESSAGE
403Wrong client ID or secret key, often because the keys were regenerated on the portal
500Usually a tax number or income source sequence that does not match, sometimes the keys or an unapproved tax rate
504The system could not be reached: a firewall on your side or a problem on ISTD's side
EINV_STATUSMeaning
SUBMITTEDAccepted. The QR code is in EINV_QR
ALREADY_SUBMITTEDThe same ID and UUID were accepted before. The original QR code comes back
NOT_SUBMITTEDRefused. QR code, number, UUID and signed invoice are empty, and the errors are in EINV_RESULTS

A successful reply, with the long Base64 values shortened:

{
  "EINV_RESULTS": {
    "status": "PASS",
    "INFO": [{
      "type": "INFO",
      "status": "PASS",
      "EINV_CODE": "XSD_VALID",
      "EINV_CATEGORY": "XSD validation",
      "EINV_MESSAGE": "Complied with UBL 2.1 standards"
    }],
    "WARNINGS": [],
    "ERRORS": []
  },
  "EINV_STATUS": "SUBMITTED",
  "EINV_SINGED_INVOICE": "<signed invoice, Base64>",
  "EINV_QR": "<QR text, Base64>",
  "EINV_NUM": "INV-1001",
  "EINV_INV_UUID": "3f6c1b2e-8a4d-4c9e-b7a1-2d5e9f0c4a18"
}

Keep the full reply with the invoice, show the user a short message, and log every send, reply and retry in detail, as the guide asks.

Printing and checking the QR code

Encode the EINV_QR text into the QR image exactly as it arrives. Do not decode it, shorten it or build a code of your own, because a code that did not come from the national system fails the check. ISTD's guide names one way to check it: scan the code with the government Sanad app, under the option for verifying digital documents. A valid code shows the total, the invoice number, the tax, the date, and the seller's tax number and name.

The QR text is long, so on 58 mm and 80 mm thermal receipts print the code as large as the paper allows, and scan a printed receipt with Sanad before you go live.

Returns and credit notes

An accepted invoice cannot be changed. A return is a new document with the value 381, and the same name code and currency as the original. The guide's rules:

  • cac:BillingReference carries the original invoice's ID, UUID and total.
  • The reason goes in cac:PaymentMeans, after the seller's income source sequence.
  • Each return line keeps the line ID of the original item, so store line IDs at the moment of sale. Returns work on quantities only, up to what was sold.
  • One invoice can take several returns until all of its quantities are used up, and the buyer details must match the original.
<cbc:ID>RET-0001</cbc:ID>
<cbc:UUID>9b2d7e41-5c3a-4f86-a0d2-7e1c6b8f3a95</cbc:UUID>
<cbc:IssueDate>2026-10-22</cbc:IssueDate>
<cbc:InvoiceTypeCode name="012">381</cbc:InvoiceTypeCode>

<!-- before AdditionalDocumentReference: the original invoice -->
<cac:BillingReference>
  <cac:InvoiceDocumentReference>
    <cbc:ID>INV-1001</cbc:ID>
    <cbc:UUID>3f6c1b2e-8a4d-4c9e-b7a1-2d5e9f0c4a18</cbc:UUID>
    <cbc:DocumentDescription>11.600</cbc:DocumentDescription>
  </cac:InvoiceDocumentReference>
</cac:BillingReference>

<!-- after SellerSupplierParty, before TaxTotal: the reason -->
<cac:PaymentMeans>
  <cbc:PaymentMeansCode listID="UN/ECE 4461">10</cbc:PaymentMeansCode>
  <cbc:InstructionNote>Damaged item returned</cbc:InstructionNote>
</cac:PaymentMeans>

<!-- the same line ID and unit price as line 1 of the original -->
<cac:InvoiceLine>
  <cbc:ID>1</cbc:ID>
  <cbc:InvoicedQuantity unitCode="PCE">1.000</cbc:InvoicedQuantity>
  <!-- amounts and tax as in the original line -->
</cac:InvoiceLine>

Retries, offline sales and duplicates

The national system identifies an invoice by its ID and UUID together. If a send fails or times out, send the same invoice again with the same ID and UUID, never a new UUID. If the first attempt was in fact accepted, the reply is ALREADY_SUBMITTED with the original QR code, so the retry is safe. A system that generates the UUID at send time and does not store it creates a second invoice on every retry.

At a till, the sale should never wait for the tax system. In Ghalleh, an invoice for a sale made offline waits in a queue and is checked before it is sent, so nothing is submitted twice.

Errors and what fixes them

MessageCauseFix
This user is not authorized to submit this type of invoiceThe invoice type does not match the registrationWork out the type code from the registration
Total General Amount is Not CorrectA total does not add up from its linesRecalculate every total from the lines, round last
Bayer name is missing (spelled this way)No buyer name on a credit invoice, or on a cash invoice above 10,000 JODAsk for the name before issuing
The ID number must be uniqueTwo lines share a line IDNumber the lines 1, 2, 3 in each invoice
General tax percentage must be zeroA 0% line marked SUse O, or Z for an exempt item
Invalid Invoice MinificationThe opening Invoice tag spans several linesWrite it on one line
Reason for note is requiredA return sent without a reasonAdd cac:PaymentMeans with the reason
The unit price must match the unit price in the original invoice.A return line with a different line ID or priceCopy line IDs and prices from the original

The last two came back on our own test returns. The others are listed in ISTD's guide.

Test checklist before you go live

Version 1.5 of the guide documents one address and no test environment. When we built ours, every test was a real invoice on the taxpayer's record, so keep tests small and reverse each one with a return.

  1. Confirm the registration and the income source sequence with the business's accountant, and check that the tax number and registered name match ISTD records exactly.
  2. Validate your XML against the UBL 2.1 schema before you send anything.
  3. Send one small cash invoice, then send it again with the same ID and UUID and confirm that you get ALREADY_SUBMITTED.
  4. Print the receipt and scan its QR code in Sanad.
  5. Return part of a real invoice, then the rest of it.
  6. Send a mixed invoice with taxed, zero rated and exempt lines, priced with tax included.
  7. Cut the network in the middle of a send and confirm that the retry reuses the UUID.

Build it, or use a product that already connects

Many products already connect. Odoo's Jordan E-Invoicing module, for example, takes the client ID, secret key and activity number and adds the returned QR code to the PDF, as its Jordan documentation explains. If your product has a connection that works, keep it.

Build your own when your system has none, or when the one you have keeps failing. For who must use JoFotara and who is excluded, read our JoFotara e-invoicing guide. If you are choosing the system itself, see Odoo or a custom ERP and what an ERP system is. To have the connection built and tested on your system, describe it on the contact page and a written proposal follows within one business day.

Questions

Is there a JoFotara sandbox or test environment?

Version 1.5 of ISTD's technical guide, approved in May 2026, documents one submission address and no test environment. Every test is a real invoice on the taxpayer's record, so keep tests small and reverse them with a return.

Do I need a certificate or a digital signature to use the JoFotara API?

No. The request carries the client ID, the secret key and the XML. The national system signs the invoice and sends the signed copy back in the reply.

Where do I get the JoFotara client ID and secret key?

The taxpayer creates them on the JoFotara portal under device linking: add a new link, enter a user name and choose the income source sequence. Keep them out of source code and regenerate them if they leak.

Is the JoFotara API documentation available in English?

ISTD publishes the technical guide in Arabic. The XML element names follow the UBL 2.1 standard, so they read the same in any language, and the error messages in the replies are in English.

What does HTTP 500 mean when sending to JoFotara?

Usually the seller's tax number or income source sequence does not match ISTD records. It can also be the keys, or a tax rate that is not on ISTD's approved list.

What if the connection drops after I send an invoice?

Send it again with the same ID and UUID. If the first attempt was accepted, the reply is ALREADY_SUBMITTED with the original QR code. A new UUID would create a second invoice.

Does JoFotara accept a discount on the whole invoice?

No. Discounts are accepted per line only, as positive amounts. Spread an invoice discount across the lines before you build the XML.

Tell us what you are building

A written proposal with a fixed price and a clear scope.

Send it now and the written proposal reaches you within one business day.

WhatsAppCall us