Qoyod
Pricing
Qoyod
Pricing

Knowledge Base

JoFotara Validation Checklist Before You Submit

A JoFotara validation checklist is the set of checks your accounting software runs on an invoice file before it sends the invoice to the National Invoicing System (JoFotara), so that it catches the error the Income and Sales Tax Department (ISTD) would otherwise reject the invoice for. It is the second of the ten guidelines in ISTD’s technical guide for linked systems, and the goal the guide states for it is to reduce 400 errors.

The short answer is that the guide publishes no ready-made checklist, but it does document the rules such a checklist rests on, spread across its field tables, its total formulas and its error messages. This article gathers those rules into one checklist, ordered by the parts of the invoice. For each check it gives the rule as the guide states it and the error that matches it, and it points to the article that explains the rule in detail. It is written for anyone who builds or reviews the link between an accounting or ERP system and JoFotara.

Page of the Arabic technical guide showing instruction 2, "Validate before sending" (التحقق قبل الإرسال): confirm the data is correct before submission, such as totals, taxes, the taxpayer number, the buyer number and the mandatory fields, to reduce 400 errors, with nothing blurred.
Page from the Arabic technical guide for integrating with the National Invoicing System through the API; source: Income and Sales Tax Department, version 1.5, p. 104.

What guideline 2 asks for before you submit to JoFotara

The guideline appears in the guidelines table on page 104 of the technical guide (version 1.5) under the title “Validate before sending” (التحقق قبل الإرسال). This is its description in the guide.

«التأكد من صحة البيانات قبل الإرسال مثل: المجاميع، الضرائب، رقم المكلف، رقم المشتري، والحقول الإلزامية لتقليل أخطاء 400».

In English, the guide asks the system to confirm that the data is correct before sending, for example the totals, the taxes, the taxpayer number, the buyer number and the mandatory fields, in order to reduce 400 errors. ISTD publishes this guide in Arabic only; the English here is our rendering, and the Arabic text is the authority.

Three points in this text shape how the checklist is built.

  • The examples are not a closed list. The guide’s wording means that totals, taxes, the two numbers and the mandatory fields are examples of what to check. The remaining rules are spread across the guide’s tables and error messages, and the checklist below collects them.
  • The goal is to reduce the 400 code. The guide ties the guideline to this code, which comes back when the values in the XML file contain a wrong value, with the detail in the EINV_MESSAGE field. Our error codes hub covers how to read the codes the system returns.
  • Guideline 2 completes guideline 1. The first guideline asks the file to follow the UBL 2.1 standard in its structure, and the second moves on to the correctness of the values inside that structure. That is why the checklist starts with structure and then moves to values. Our article on UBL 2.1 covers the structure.

Our article JoFotara Guidelines for Linked Systems: All Ten Explained shows where this guideline sits among the others. Here we go through what your system actually checks, one check at a time.

What your system can check and what it cannot

Before you write any check, it helps to separate three kinds of conditions, because each kind belongs in a different place in pre-submission validation.

Conditions the file alone decides

Your system can judge these completely, without asking anyone. They include the opening tag being on one line, each line number being unique, the postal code being no longer than 5 characters, the totals matching the lines, and the tax category agreeing with its rate. They make up the largest part of the checklist, and checking them locally stops a wrong invoice from reaching the system at all.

Conditions that depend on data held by ISTD

Some values are correct only against ISTD’s records, not against the file. The guide says that code 500 comes back when there is an error in the tax number or the income-source sequence, and that the message This user is not authorized to submit this type of invoice appears when the taxpayer sends an invoice type that does not match their tax number or their income-source sequence. For a development zones invoice, the buyer must be registered in the development zones and hold a valid exemption letter entered on the financial system.

Here your system can confirm that the field is not empty and that its value matches what you saved in the link settings about your registration. But it cannot see ISTD’s records, so it cannot confirm, for example, that the buyer is registered in the development zones. For these conditions, the outcome stays in the system’s response.

Errors unrelated to the invoice values

The guide lists code 403 for an error in the Client ID or the Secret Key, and code 504 for the inability to reach the system because of the taxpayer’s firewall or the ISTD site. Checking the invoice file reveals neither, because the fault lies in the linking data or in the connection, not in the file.

The guide’s shading: how to know what must be filled in

The guideline mentions “the mandatory fields” without listing them, and the guide’s reference for them is the shading of its tables. On page 12 the guide explains the color key that repeats in every invoice template.

Page of the Arabic technical guide showing the color key: yellow for mandatory variables and green for optional variables, with the basic invoice information template, with nothing blurred.
Page from the Arabic technical guide for integrating with the National Invoicing System through the API; source: Income and Sales Tax Department, version 1.5, p. 12.

Elements shaded yellow are variables that the seller’s system must fill in, elements shaded green are optional variables, and everything else is fixed description that is copied unchanged. Across all the templates there are five green elements, which are the note cbc:Note, the buyer number value, the postal code, the governorate code and the phone. Every other variable is mandatory.

The guide also adds conditions that change the status of some fields by invoice type. The buyer name becomes mandatory on a receivable invoice and on a cash invoice above the stated limit, and the buyer’s tax number becomes mandatory on a development zones invoice. So it is not enough for your system to check the yellow fields. It has to read the invoice type first and then apply that type’s conditions. Our article JoFotara Mandatory and Optional Fields explains the shading and what changes by invoice type.

JoFotara validation checklist before you submit

The tables below follow the parts of the invoice file, from structure to totals. Each row is a rule documented in version 1.5 of the technical guide. Where the guide gives no error message for a rule, we say so instead of guessing the message.

1. Structure and invoice identity

Scroll the table sideways to see the remaining columns

Check Rule documented in the guide Error it matches Detail
File structure An XML file that conforms to the UBL 2.1 standard (guideline 1, p. 104) Any structural fault leads to rejection of the invoice Our article on UBL 2.1
Declaration and opening tag The same declaration in every file, and the <Invoice> opening tag with all its attributes on one line (p. 102) Invalid Invoice Minification (p. 102) Our article on XML minification
The value of cbc:ProfileID The value reporting:1.0 in every invoice (p. 10) The technical guide documents no specific message for this case. Same UBL 2.1 article
Invoice number and unique identifier cbc:ID and cbc:UUID together are the key of the invoice. Your system generates the identifier and stores it Generating a new identifier when you resend duplicates the invoice Our article on the UUID
Invoice date The format yyyy-mm-dd, as in all the XML examples in the guide The technical guide documents no specific message for this case. None
Invoice type The value 388 for a new invoice and 381 for a return. The name attribute has three digits that set the trade type, the payment method and the tax family This user is not authorized to submit this type of invoice Our error codes hub
Invoice counter (ICV) A counter created by the taxpayer that starts sequentially from 1 (p. 13) The technical guide documents no specific message for this case. Our article on the ICV

This part has one more requirement that you test by behavior rather than by rule. Store the invoice number and its unique identifier before sending, so that if you need to resend the invoice you resend it with the same two values.

2. Seller and buyer

Scroll the table sideways to see the remaining columns

Check Rule documented in the guide Error it matches Detail
Seller’s tax number cbc:CompanyID in the seller block carries the seller’s tax number A tax number error is among the causes of code 500 (p. 101) Our error codes hub
Income-source sequence cac:SellerSupplierParty/cbc:ID carries the income-source sequence that your system sends on Code 500, or the not-authorized message if the invoice type does not fit the sequence Same error codes hub
Seller’s name cbc:RegistrationName as registered with ISTD The technical guide documents no specific message for this case. None
Type of the buyer’s number The schemeID attribute with one of the values NIN, PN or TN, and the number contains digits only The technical guide documents no specific message for this case. Our article on buyer identification
Buyer’s name Required on a receivable invoice, and on a cash invoice worth more than JOD 10,000 or its equivalent in foreign currency Bayer name is missing Our error codes hub
Postal code cbc:PostalZone with a maximum of 5 characters Postal code length is incorrect Our error codes hub
Buyer’s phone Digits only, with at least 9 digits and at most 14 The technical guide documents no specific message for this case. None
Governorate code A code from the governorates table in the guide, such as JO-AM for Amman and JO-IR for Irbid The technical guide documents no specific message for this case. Our article on governorate codes
Buyer’s tax number in development zones Mandatory for this type, and the buyer must be registered in the development zones and hold a valid exemption letter entered on the financial system BuyerTaxNumber: The buyer's taxpayer number is not associated with the developmental arear Our error codes hub

3. Lines and taxes

Scroll the table sideways to see the remaining columns

Check Rule documented in the guide Error it matches Detail
Line number cbc:ID in each line is sequential and unique within the invoice, and you store it because a return matches lines by it The ID number must be unique Our error codes hub
Quantity Greater than zero, with up to 9 decimal places The technical guide documents no specific message for this case. Our article on InvoiceLine
Unit price Before tax, greater than zero, with up to 9 decimal places The technical guide documents no specific message for this case. Same InvoiceLine article
Discount At the line level and positive only. A discount on the whole invoice is spread across the lines before sending Its effect shows in the totals Our error codes hub
Tax category with its rate Category S for any rate other than zero. At a rate of 0%, S is not used. Use Z for exempt and O for zero-rated General tax percentage must be zero Our article on tax categories
Non-local types On General Sales Tax and Special Sales Tax invoices of these types, which are export, transit, foreign trade, assignment within free zones and development zones, the rate is 0% with category O for all goods (pp. 42 and 69) General tax percentage must be zero Same tax categories article
Rate within what the interface accepts The cbc:Percent value from the list that the guide gives for new invoices (p. 42) A rate outside the list is among the causes of code 500 (p. 101) Our error codes hub
Special Sales Tax A value entered without calculation, in a TaxSubtotal of type OTH with no cbc:Percent element, placed before the General Sales Tax block Its effect shows in the totals Our article on the OTH special tax
Income invoice Neither its lines nor its header carry a TaxTotal block The technical guide documents no specific message for this case. None

The list of rates that the guide gives on page 42 is 0, 1, 2, 3, 4, 5, 7, 8, 10 and 16. It is the list of values the API accepts in this field, not a table of General Sales Tax rates set by law, so do not use it to infer that a given rate exists. Note that the return invoice pages give the list without the zero.

4. Totals

The message Total General Amount is Not Correct is the first message the guide lists for code 400, and checking the totals locally is the clearest application of guideline 2. The table summarizes the formulas as the guide states them.

Scroll the table sideways to see the remaining columns

Element Rule in the guide What you compare it with
LineExtensionAmount (quantity × unit price) − discount The line’s own values
TaxAmount in the line (quantity × unit price − discount) × rate, and the Special Sales Tax amount is added to the base in its lines The line’s rate and category
RoundingAmount The line value plus its General Sales Tax, and the Special Sales Tax if there is one The line total
TaxExclusiveAmount The sum of (quantity × unit price) before discount All the lines
AllowanceTotalAmount and AllowanceCharge in the header Both are the sum of the line discounts Each other and the line discounts
TaxInclusiveAmount and PayableAmount Both are the sum of RoundingAmount across the lines Each other
TaxTotal in the header The sum of the General Sales Tax across the lines, in general sales tax and special tax invoices The tax of the lines
Rounding The guide allows rounding to 3 decimal places and up to 9, provided the difference is no more than 0.001 Every amount

The system does not accept a separate invoice-level discount. The discount in the header is the sum of the line discounts, so a seller who discounts the invoice total spreads that discount across the lines before sending.

5. Return invoices

A return invoice has additional conditions that your system checks before sending, and all of them are documented in the guide.

  • It carries a cac:BillingReference block with the original invoice’s number, its unique identifier (UUID) and its total.
  • The return reason is mandatory. It is written as free text in cbc:InstructionNote inside cac:PaymentMeans. Our article on the return reason covers it.
  • Returns are on quantities only. A return cannot exceed the quantity sold on the original invoice, and more than one partial return is allowed against the same invoice until its quantities are used up.
  • The line number, name and unit price are as on the original invoice.
  • The guide requires the buyer details on the return invoice to match those on the original sales invoice it is linked to.
  • If the return covers part of the quantity, the discount is the part of the item’s total discount that corresponds to the returned quantity.
  • The invoice type code in the name attribute is the code of the original invoice itself, and the value is 381.

The error messages the checklist targets

On pages 101 and 102 the guide lists the main messages for code 400, introduced with the words “among the most important”, which means the list is not complete. Each message matches one or more rows in the tables above, which makes the messages a good reference for testing the checks in your own system.

Page of the Arabic technical guide showing the explanation of 400 Bad Request and its main messages: Total General Amount is Not Correct, This user is not authorized to submit this type of invoice, Bayer name is missing and The ID number must be unique, with nothing blurred.
Page from the Arabic technical guide for integrating with the National Invoicing System through the API; source: Income and Sales Tax Department, version 1.5, p. 101.
Page of the Arabic technical guide showing the rest of the 400 messages: General tax percentage must be zero, the BuyerTaxNumber message for development zones, and Postal code length is incorrect, with nothing blurred.
Page from the Arabic technical guide for integrating with the National Invoicing System through the API; source: Income and Sales Tax Department, version 1.5, p. 102.

You can use these messages in two ways. The first is to confirm that every message has a matching check in your system. The second is to write your internal validation messages in language an accountant understands, because guideline 6 in the guide asks you to log errors in detail internally and show the user a simplified message. Note that the guide spells some messages inexactly, such as Bayer name is missing, so search responses for the text as it arrives.

What the guide does not document, so do not build a check on it

Pre-submission validation is only as useful as its rules are close to the system’s rules. A rule that a developer invents may reject a valid invoice or pass a wrong one. Version 1.5 of the guide leaves several points without a rule, so do not make them a condition in your system before you confirm them.

  • Other buyer address fields. The guide gives only the postal code and the governorate code from the buyer’s address.
  • Accepted values of the currencyID attribute. The guide’s examples use the value JO on every amount, and the guide does not say whether other values are accepted.
  • Unit of measure codes. Only PCE appears in the lines of new invoices, and the guide gives no list of codes and no rule for them.
  • Exchange rate. The guide has no element for an exchange rate and no rule for conversion to the dinar.

Do not copy the guide’s XML examples as they are to test your rules, because some of them contain unique identifiers in an invalid format or repeated quotation marks. Separate articles in our Developer Center cover those examples and the testing of invoice submission.

Where the check sits in the submission flow

The guide does not say when the check runs inside your system or in what order. The order below is our suggestion, built from the logic of the guidelines themselves.

  1. Check the invoice when it is created, before it is built into an XML file, so the accountant can correct the value while working on it.
  2. Check the file after it is built and before it is Base64-encoded, to confirm the structure, the opening tag and the totals as they will actually arrive.
  3. Store the invoice number and its unique identifier before sending.
  4. Send the invoice, then judge it from the value of EINV_STATUS in the response file, not from the HTTP code alone, as guideline 4 asks.
  5. If an error comes back despite the check, read EINV_MESSAGE, add the missing rule to your list, and resend with the same number and the same unique identifier.

After acceptance, the QR code comes back in EINV_QR, and the guide requires it to be shown on the seller’s invoice. The invoice counts as received and approved only when this code is present.

How Qoyod helps

If you issue your invoices from Qoyod, Qoyod’s integration with the National Invoicing System works on this part as follows.

  • A check before sending. Qoyod checks each invoice at field level as it is created, covering the tax number, the document type and payment method, the General Sales Tax rate and whether the lines are complete, and alerts you to any error before the invoice is sent, to reduce rejections. The pre-send check is an alert, not a guarantee. The final judgment stays with ISTD.
  • Every invoice’s status in view. ISTD returns the invoice status and any error message, and Qoyod shows them in its status panel.
  • Resending with the same identifier. The status panel lists invoices that were not sent and need to be resent, and when you resend one it keeps the same UUID.

Where to go next

For a wider view of the system and how to connect your business to it, read our article Jordan’s National E-Invoicing System.

Qoyod · National Invoicing System

E-invoicing and full accounting in one system

Qoyod is integrated with the National Invoicing System (JoFotara). You issue your invoice in Jordanian dinars from Qoyod, it is booked to your ledgers automatically and sent to the system, and once it is accepted it comes back with a QR code from the Income and Sales Tax Department.

Frequently asked questions

What does validation before sending to JoFotara mean?

It means guideline 2 of ISTD’s technical guide, which asks your system to confirm that the invoice data is correct before it is sent, for example the totals, the taxes, the taxpayer number, the buyer number and the mandatory fields. The goal the guide states is to reduce 400 errors.

Does pre-submission validation guarantee that the invoice is accepted?

No. Pre-submission validation reduces rejections but does not guarantee acceptance. Some conditions depend on data held by ISTD that your system cannot see, such as your registration, the income-source sequence and the buyer’s registration in the development zones, and the final judgment stays with the value of EINV_STATUS in the response file.

Does the guide publish a complete list of validation rules?

No. Guideline 2 gives examples introduced with the word “for example”, and the guide has no single list of all the checks. This article therefore collects the rules documented in the guide’s tables and error messages, and it adds no rule that the guide does not state.

How do I know which fields are mandatory in the invoice file?

You read them from the shading of the tables in version 1.5 of the technical guide. Yellow marks mandatory variables, green marks optional variables, and the remaining elements are fixed description that is copied as it is.

What should I do if an invoice is rejected despite the check?

Read the EINV_MESSAGE message in the response file as it is, fix the value it points to, and resend with the same number and the same unique identifier, without generating a new identifier.

Does Qoyod check the invoice before sending it?

Qoyod checks each invoice at field level as it is created, covering the tax number, the document type and payment method, the General Sales Tax rate and whether the lines are complete, and alerts you to any error before the invoice is sent, to reduce rejections. The pre-send check is an alert, not a guarantee.

References

  • Income and Sales Tax Department (ISTD), technical guide for integrating with the National Invoicing System through the API, version 1.5 (in Arabic), pp. 10, 12, 13, 42, 69, 101, 102 and 104.
Guides

Continue your learning journey

Explore the rest of Qoyod’s guides, or start applying what you’ve learned.

Live webinars hosted by the Qoyod team to help you use the software easily and answer your questions.

Discover Qoyod’s latest updates, ongoing improvements, and new features in one place.

Our team is ready to help you and provide instant support for any issue you face, around the clock.