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
- 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.
- Build the XML. Write the invoice as UBL 2.1, with the invoice type that matches the taxpayer's registration.
- 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. - Send and read. POST the JSON with the two credential headers, then check the HTTP status and
EINV_STATUS. - 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.
| Registration | Third digit | Local sale, cash | Local sale, on credit |
|---|---|---|---|
| Not registered for sales tax (income invoice) | 1 | 011 | 021 |
| Registered for general sales tax | 2 | 012 | 022 |
| Registered for special sales tax | 3 | 013 | 023 |
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.
| Element | What goes in | Rule |
|---|---|---|
cbc:ID | Your invoice number | With the UUID, the key that stops duplicates |
cbc:UUID | A unique ID your system generates | Store it before sending, reuse it on retries |
cbc:IssueDate | The invoice date | Format yyyy-mm-dd |
cbc: | JOD, or another currency on ISTD's list | One currency for the whole invoice |
ICV in cac: | The invoice counter | Starts at 1 and counts up |
cac: | Seller tax number and registered name | Must match ISTD records |
cac: | Buyer ID, name, postal code, governorate, phone | Name required on credit invoices and on cash invoices above 10,000 JOD |
cac: | The income source sequence | On every invoice |
cac:InvoiceLine | One element per item | Each 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:
| Field | How it is calculated |
|---|---|
LineExtensionAmount | Quantity times unit price, minus the line discount |
TaxAmount on a line | The line amount times the line's tax rate |
RoundingAmount | The line amount plus the line tax |
TaxExclusiveAmount | Quantity times unit price for all lines, before discounts |
AllowanceTotalAmount | The sum of the line discounts |
TaxInclusiveAmount and PayableAmount | The 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
| Category | Use it for | Rate |
|---|---|---|
S | A taxed item | An approved rate: 1, 2, 3, 4, 5, 7, 8, 10 or 16% |
Z | An exempt item | 0% |
O | A zero rated item, and every line on export, development zone, transit, foreign trade and free zone sales invoices | 0% |
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 status | Meaning |
|---|---|
| 200 | Processed. Read EINV_STATUS for the result |
| 400 | A value in the XML is wrong. The reason is in EINV_MESSAGE |
| 403 | Wrong client ID or secret key, often because the keys were regenerated on the portal |
| 500 | Usually a tax number or income source sequence that does not match, sometimes the keys or an unapproved tax rate |
| 504 | The system could not be reached: a firewall on your side or a problem on ISTD's side |
EINV_STATUS | Meaning |
|---|---|
SUBMITTED | Accepted. The QR code is in EINV_QR |
ALREADY_SUBMITTED | The same ID and UUID were accepted before. The original QR code comes back |
NOT_SUBMITTED | Refused. 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:BillingReferencecarries 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
| Message | Cause | Fix |
|---|---|---|
This user is not authorized to submit this type of invoice | The invoice type does not match the registration | Work out the type code from the registration |
Total General Amount is Not Correct | A total does not add up from its lines | Recalculate 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 JOD | Ask for the name before issuing |
The ID number must be unique | Two lines share a line ID | Number the lines 1, 2, 3 in each invoice |
General tax percentage must be zero | A 0% line marked S | Use O, or Z for an exempt item |
Invalid Invoice Minification | The opening Invoice tag spans several lines | Write it on one line |
Reason for note is required | A return sent without a reason | Add 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 price | Copy 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.
- 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.
- Validate your XML against the UBL 2.1 schema before you send anything.
- Send one small cash invoice, then send it again with the same ID and UUID and confirm that you get
ALREADY_SUBMITTED. - Print the receipt and scan its QR code in Sanad.
- Return part of a real invoice, then the rest of it.
- Send a mixed invoice with taxed, zero rated and exempt lines, priced with tax included.
- 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.
