الرمز المربّع أسفل الفاتورة الضريبية المبسّطة ليس صورة زخرفية ولا رابطًا لموقع. هو بيانات الفاتورة نفسها، مرمّزة بصيغة محدّدة، يمكن لأي قارئ QR أن يفكّها إلى حقول مفهومة. هذه الصفحة تشرح البنية كما تُنفّذ، لا كما تُوصف.
المحتوى داخل الرمز يتكوّن من خمسة حقول مرتّبة:
| الوسم | المحتوى | مثال |
|---|---|---|
| ١ | اسم البائع كما هو مسجّل | مؤسسة النور التجارية |
| ٢ | الرقم الضريبي للبائع | 311111111111113 |
| ٣ | الطابع الزمني للفاتورة | 2026-10-21T12:00:00Z |
| ٤ | الإجمالي شاملًا الضريبة | 115.00 |
| ٥ | مبلغ الضريبة وحده | 15.00 |
اختصار 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، فسيُقرأ في مكان آخر بخطأ ساعات.
إن انتهت البايتات تمامًا بعد الحقل الخامس، فالتشفير سليم. وإن بقي بايت زائد أو نقص شيء، فالخطأ في حساب الطول غالبًا.
أنشئ فاتورة برمز صحيح — بلا رفع أداة «فاتورة» تبني الرمز داخل متصفّحك بصيغة TLV، مع حساب الضريبة ومعاينة طباعة A4.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 content inside the code is made of five ordered fields:
| Tag | Content | Example |
|---|---|---|
| 1 | Seller name as registered | مؤسسة النور التجارية |
| 2 | Seller VAT number | 311111111111113 |
| 3 | Invoice timestamp | 2026-10-21T12:00:00Z |
| 4 | Total including VAT | 115.00 |
| 5 | VAT amount alone | 15.00 |
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"
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.
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.
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.
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.