← Blog How-to 9 min read · 10 September 2026

Onboarding to Fatoora: the OTP, the CSR and the two certificates, explained

A four-link chain of onboarding artefacts — a one-time code, a certificate request, a temporary certificate and a production certificate — each one unlocking the next
Four steps, one order, and an environment that has to match in all of them.

Your XML validates, your signature verifies, and the Authority still will not accept an invoice. None of it counts until the establishment is onboarded to the Fatoora platform and your solution holds a certificate the Authority issued. This is that handshake, in order, with the honest cause behind each way it fails — the companion to what a direct integration really involves, which is about the code you write. New to clearance and reporting? Start with what Phase 2 requires.

The OTP is an onboarding code, not a login code

The most misunderstood object here is six digits long. The one-time password is generated by the taxpayer from the Fatoora portal, and it authorises one issuing unit to obtain a certificate and sign for that establishment: the Authority's evidence that whoever asked was authorised by someone who can sign in to that account.

  • Not a password. It grants no portal access and identifies no user.
  • Used once. A failed attempt still consumes it: treat a code that errored as spent.
  • Short-lived, minutes rather than days, so the certificate request must exist before the code is generated.
  • Bound to one environment. The portal has an environment selector, and a code issued for one environment does not work in another. This is the single most common reason onboarding fails.

That last failure looks nothing like its cause: the code is fresh, correct and refused. The environment is chosen when the code is generated, encoded again in the certificate request your software builds, and fixed by the endpoint you call. Pin all three together first.

The sequence, and what each step produces

Four steps, then a fifth that comes round again.

StepWhat it producesWhat it provesWhat fails there
OTP from the portalSix digits, single use, short-livedThe establishment authorised this unitExpired, consumed, wrong environment
Key pair and CSRA private key you keep, and a request carrying the establishment's details and document typesNothing yet; it is a requestDetails disagree with the Authority's record
Compliance CSIDA certificate that can run the checks and nothing elseThe Authority accepts this key for this establishmentSpent code, or wrong environment
Compliance checksA pass on samples of every type the unit issuesYour generator makes documents the Authority validatesA type your code cannot build
Production CSIDThe certificate that signs live invoices, with an expiry dateThis unit may issue for realSigning later with the compliance pair
RenewalA fresh production certificateThe same, to the same standardNothing visible; it simply lapses

How many compliance documents, really

It depends on which document types the unit is registered to issue, which the certificate request declares. A solution registered for both standard and simplified invoices is checked on both, and on the credit and debit note of each: the familiar six. One registered for a single type is checked on that type alone. Any figure quoted without that qualification is a guess.

The samples must come from the code path that will produce your real invoices, signed and chained exactly as production documents are: the exercise tests the generator, not the sample. And a sample accepted with warnings passes — only a hard error stops the run — so a defect carrying a warning severity travels through onboarding into production, where it is returned on every response and rejects nothing.

Where onboarding actually fails

  • An expired or already-used code. Ordinary, and easy to mistake for something structural.
  • A code from the wrong environment. Nothing in the response points at it, so check it first.
  • Establishment data that does not match the Authority's record. Usually the address: the national address has six elements, street name, building number, postal code, city, district and country, and the last two are the ones nobody has to hand. At invoice validation the shortfall appears as BR-KSA-09, severity warning — the invoice is accepted and the complaint returned beside it, which is why it survives for months.
  • A malformed VAT number. Fifteen digits, the first and last being 3; a commercial registration number in the wrong field, a stray space or Arabic-Indic digits all fail it. This one is an error: BR-KSA-40 rejects the invoice. Check a number with the VAT number lookup.

One device, or several

The issuing unit holds its own certificate, its own invoice counter and its own hash chain. A cloud system issuing through a single queue needs one; three points of sale that can each ring up a sale in the same second need three: two issuers building on the same previous hash claim the same position in the chain.

Design for that rather than discover it: the Authority will not stop you. Both chain rules, BR-KSA-61 (the previous invoice hash must be present) and BR-KSA-26 (it must be a Base64-encoded SHA-256 digest, computed as the specification sets out), carry a severity of warning. Documents from a diverging chain are accepted and handed to customers, the complaint returned quietly beside each acceptance. Nothing bounces, so nobody looks, and what is lost is the tamper-evidence the chain existed to provide: it surfaces in an audit, not at submission. The counter is stricter, BR-KSA-33 being an error.

Renewal, and the silence

The production certificate has a validity period, and renewal runs the same path: fresh key pair, fresh certificate request, fresh OTP, once per unit. It is the onboarding you just finished, on a day nobody scheduled.

The dangerous property is that expiry is silent. No grace period, no banner: submissions simply stop being accepted. Standard invoices can no longer be cleared, so the document you owe a business buyer cannot be issued at all, while simplified ones keep printing at the till as every report fails behind them, leaving a backlog whose 24-hour windows run out unattended. Record the expiry date the day you connect, against a named owner. Forty branches means forty renewals.

Verify instead of assuming

Do not trust the checklist that says you are connected. Issue one real invoice and read its QR code: a Phase 2 QR carries eight TLV fields where a Phase 1 QR carried five, and three of the extra ones, the invoice hash, the signature and the public key, cannot exist unless the document was genuinely stamped. Read a five-field code and nothing is being signed, whatever the dashboard says. Our free QR code reader decodes them field by field, beside the other free tools.

Then check what a configuration file hides: that the credentials in use are the production pair, not the compliance pair they resemble, and that the environment is the live one — a test environment accepts everything and reports nothing to anybody. Rejections afterwards carry a code, listed in the error code reference and explained in how to read a rejection.

Or hand the handshake over

ZATCA Tools does this handshake for you: one OTP, and we generate the certificate request, obtain the compliance certificate, run the compliance checks and obtain the production certificate. Then signed invoices with a compliant QR, cleared or reported; signed XML archived six years and downloadable; rejections shown with the official code and a link to its guide, from 135 documented codes, 24 with full guides; and a device, certificate and chain per branch. Integrations for WooCommerce, Shopify, n8n and WHMCS, a REST API, and a Partner API for software companies serving many merchants (see the partner guide). Not an accounting system. Free during the launch period, starting at 50 invoices and expanding: create an account, talk to us, or read on at the English blog.

Frequently asked questions

Is the ZATCA OTP the same as a login code? +
No, and the confusion costs hours. It is an onboarding code: six digits, generated by the taxpayer from the Fatoora portal, authorising one issuing unit to obtain a certificate and sign invoices for that establishment. It is not a password, it identifies no user, and nothing signs in with it. It is used once and expires within minutes, so it has to be generated at the moment onboarding runs rather than saved for later.
My OTP was rejected the second I pasted it. What is wrong? +
Assume the environment first. The Fatoora portal has an environment selector, and a code generated for one environment is meaningless in another — the code looks fresh and correct and is refused anyway. The environment is also encoded in the certificate request your software builds, and it has to match both the code and the endpoint you call. After that, the ordinary causes: the code expired, or a first failed attempt already consumed it. Generate a new one rather than retrying the same digits.
Who generates the OTP — the business or its software vendor? +
The taxpayer, from their own Fatoora account. A vendor cannot generate it for you, and a vendor who asks for your portal sign-in credentials instead of for a code you generate is asking for the wrong thing. The code delegates one issuing unit; the account is everything.
How many compliance documents will we be asked for? +
It depends on which document types the unit is registered to issue, which the certificate request declares. A solution registered for both standard and simplified invoices is checked on both, and on the credit and debit note of each — the familiar six. A solution registered for a single type is checked on that type alone. Anyone quoting a number without that qualification is guessing.
What happens when the production certificate expires? +
Submissions stop being accepted, with no warning beforehand. Standard invoices can no longer be cleared, so the document you owe a business buyer cannot be issued at all; simplified invoices keep printing at the till while every report fails, leaving a backlog whose 24-hour windows are expiring in the background. Renewal runs the same path with a fresh OTP, once per device. Record the expiry date the day you connect, against a named owner.
Do we need one certificate per branch or per till? +
Per issuing unit. One cloud system issuing through a single queue needs one; three points of sale that can each ring up a sale in the same second need three, because two issuers building on the same previous invoice hash claim the same position in the chain. The trap is that the Authority does not reject them: the two chain rules, BR-KSA-61 and BR-KSA-26, both carry a severity of warning, so a diverging chain runs on accepted and unnoticed.
How do I confirm the production certificate is really the one signing? +
Issue one real invoice and read its QR code. A Phase 2 QR carries eight TLV fields where a Phase 1 QR carried five, and three of the extra ones — the invoice hash, the signature and the public key — cannot exist unless the document was genuinely stamped. If you read a five-field code, nothing is being signed, whatever your dashboard says. Our QR code reader decodes them field by field.
Ready to connect your business?

Connecting is free and takes under five minutes.

Start for free