رمز QR في الفاتورة الضريبية: بنيته الفعلية

آخر تحديث: ٢١ أكتوبر ٢٠٢٦ · قراءة ٥ دقائق

الرمز المربّع أسفل الفاتورة الضريبية المبسّطة ليس صورة زخرفية ولا رابطًا لموقع. هو بيانات الفاتورة نفسها، مرمّزة بصيغة محدّدة، يمكن لأي قارئ QR أن يفكّها إلى حقول مفهومة. هذه الصفحة تشرح البنية كما تُنفّذ، لا كما تُوصف.

الوسوم الخمسة

المحتوى داخل الرمز يتكوّن من خمسة حقول مرتّبة:

الوسمالمحتوىمثال
١اسم البائع كما هو مسجّلمؤسسة النور التجارية
٢الرقم الضريبي للبائع311111111111113
٣الطابع الزمني للفاتورة2026-10-21T12:00:00Z
٤الإجمالي شاملًا الضريبة115.00
٥مبلغ الضريبة وحده15.00

ما معنى TLV؟

اختصار Tag · Length · Value. كل حقل يُخزَّن بثلاثة أجزاء متتالية:

ثم تُلصق الحقول الخمسة على التوالي، ويُرمَّز الناتج بـBase64، وهذا النص الأخير هو ما يوضع داخل رمز QR.

Tag 1 | Len 38 | "مؤسسة النور التجارية"   ← 38 بايتًا لا 20 حرفًا
Tag 2 | Len 15 | "311111111111113"
Tag 3 | Len 20 | "2026-10-21T12:00:00Z"
Tag 4 | Len 6  | "115.00"
Tag 5 | Len 5  | "15.00"

الفخّ الأول: الطول بالبايتات لا بالحروف

هذا أكثر ما يُخطئ فيه من يكتب مولّدًا بنفسه. الحرف العربي في UTF-8 يشغل بايتين غالبًا، وبعض الحروف ثلاثة. فإن كتبت طول «مؤسسة النور التجارية» على أنه عدد الحروف (٢٠) فسيفشل فكّ الرمز: القارئ سيقرأ ٢٠ بايتًا فقط ويترك الباقي، فتختلّ كل الحقول التالية.

القاعدة: احسب الطول من عدد البايتات بعد الترميز، لا من string.length.

الفخّ الثاني: تنسيق الأرقام

المبالغ تُكتب بصيغة عشرية بسيطة بفاصل نقطي وخانتين: 115.00. ولا تُستخدم فواصل الآلاف، ولا الفاصلة العشرية العربية (٫)، لأن القارئ يتوقّع نصًّا لاتينيًّا في هذه الحقول تحديدًا.

الفخّ الثالث: الطابع الزمني

يُكتب بصيغة ISO 8601 بالتوقيت العالمي: YYYY-MM-DDThh:mm:ssZ. وإن استخدمت توقيتًا محليًّا بلا لاحقة Z، فسيُقرأ في مكان آخر بخطأ ساعات.

كيف تتحقّق من رمزك بنفسك؟

  1. صوّر الرمز أو احفظه.
  2. افتح أي قارئ QR، وانسخ النص الناتج.
  3. فكّ ترميز Base64 (أي أداة، أو سطر أوامر).
  4. اقرأ البايتات: الأول وسم، الثاني طول، ثم القيمة بطول ذلك الطول بالضبط.

إن انتهت البايتات تمامًا بعد الحقل الخامس، فالتشفير سليم. وإن بقي بايت زائد أو نقص شيء، فالخطأ في حساب الطول غالبًا.

أنشئ فاتورة برمز صحيح — بلا رفع أداة «فاتورة» تبني الرمز داخل متصفّحك بصيغة TLV، مع حساب الضريبة ومعاينة طباعة A4.
تنبيه: هذه الصفحة شرح تقني لبنية الرمز، وليست استشارة ضريبية ولا بيانًا رسميًّا عن الالتزام. للالتزام النظامي ارجع إلى المصادر الرسمية للهيئة.

The QR code on a tax invoice: its actual structure

Last updated: 21 October 2026 · 5 min read

The square code at the bottom of a simplified tax invoice is not a decorative image or a link to a website. It is the invoice data itself, encoded in a specific format that any QR reader can decode into readable fields. This page explains the structure as it is implemented, not as it is described.

The five tags

The content inside the code is made of five ordered fields:

TagContentExample
1Seller name as registeredمؤسسة النور التجارية
2Seller VAT number311111111111113
3Invoice timestamp2026-10-21T12:00:00Z
4Total including VAT115.00
5VAT amount alone15.00

What does TLV mean?

Short for Tag · Length · Value. Each field is stored as three consecutive parts:

The five fields are then joined one after another, the result is encoded in Base64, and that final text is what goes inside the QR code.

Tag 1 | Len 38 | "مؤسسة النور التجارية"   ← 38 bytes, not 20 characters
Tag 2 | Len 15 | "311111111111113"
Tag 3 | Len 20 | "2026-10-21T12:00:00Z"
Tag 4 | Len 6  | "115.00"
Tag 5 | Len 5  | "15.00"

Trap one: length in bytes, not characters

This is the most common mistake when people write their own generator. An Arabic letter in UTF-8 usually takes two bytes, and some take three. So if you write the length of the seller name above as its number of characters (20), decoding will fail: the reader reads only 20 bytes and leaves the rest, and every following field breaks.

The rule: compute the length from the number of bytes after encoding, not from string.length.

Trap two: number format

Amounts are written as a plain decimal with a dot and two digits: 115.00. No thousands separators, and no Arabic decimal separator (٫), because the reader expects Latin text in these fields specifically.

Trap three: the timestamp

It is written in ISO 8601 format in UTC: YYYY-MM-DDThh:mm:ssZ. If you use local time without the Z suffix, it will be read elsewhere with an error of several hours.

How do you check your own code?

  1. Take a photo of the code or save it.
  2. Open any QR reader and copy the resulting text.
  3. Decode the Base64 (any tool, or a command line).
  4. Read the bytes: the first is the tag, the second the length, then the value at exactly that length.

If the bytes end exactly after the fifth field, the encoding is correct. If one byte is left over or something is missing, the error is usually in the length calculation.

Create an invoice with a correct code — no upload The «Fatoora» tool builds the code inside your browser in TLV format, with VAT calculation and an A4 print preview.
Note: this page is a technical explanation of the code structure, not tax advice and not an official compliance statement. For regulatory compliance, refer to the authority's official sources.
تواصل معناأسئلة المنصّات والتراخيص والتنصيب — نجيب مباشرة.