Request for Guidance on Integrating Manager API with KSA Fatoora E-Invoicing (Phase II)

Technically speaking you can use different custom fields for production and simulation. This way data in simulation wonโ€™t override/conflict with data in production.

For the record, I donโ€™t have an opinion on how it should be done.

Can you please inform me from where did you get this data file? or you added it to Manager as custom fields?

regards,

This was a video for another program called SMACC

Iโ€™m actually not sure how this could be implemented technically or how difficult it would be

@Mabaega Iโ€™ve noticed that the XML file is no longer available for download if it isnโ€™t downloaded the first time

Is there a way to regenerate the XML file?

Or could we set up the download step to automatically email the XML file to users?

This way, we can ensure it is not missed

The downloaded txt file stores all the invoice information and the response from the Zatca server.
The XML can be recreated by decoding the base64Invoice in the file.

For automatic download approved xml when invoice successfully Reported or Cleared, I will try to add it.

For auto send approved xml via e-mail, I will try to learn it.

Much appreciated @Mabaega this wouldnโ€™t come to light without your dedication

Is it something can be done by normal users ?

Not sure, if you have Notepad++ installed on your computer, you can try itโ€ฆ

  1. Open Notepad++
  2. Open the downloaded txt file
  3. Copy text value from Base64Invoice (Simplified Invoice) or text value from clearedInvoice (Standard Invoice) to a new page
  4. Block all copied text and right click.
  5. From the menu that appears, select Plugin commands - Base64 Decode (text should have changed to xml)
  6. Save the file with XML extension.

I need your assistance to complete the setup. I successfully installed the linux server version and followed your instructions, but I encountered an error when clicking โ€œRelayโ€ to transfer to AZTCA EGS. The error message reads โ€œ0 API calls were successful, but 25 failedโ€ when I click โ€œupdate Business Dataโ€. I double-checked the data and followed your examples, but without success. could you please help me resolve this issue?

@gwmsist

Can you provide more information, about the version of the manager you are using.

I just tried Manager Server Edition hosted on linux. I didnโ€™t have any issues with Business Data setup and Device Registration.

The problem that appeared before was caused by the access permission on the manager,
make sure the user who did the setup is an administrator.
Maybe this can help

Hi Mabaega
Thank you for your prompt response. I am using version 24.12.11.1975. Today, I ran chmod with 755 to the directory and all files/subdirectory with no luck. any other suggestion?

Try to check the debug on your browser, there may be information about the failure of API access to the manager.

Hi Mabaega,
I tired it from different browsers and different computers with no luck. the inspector showed the following with โ€œblocked mixed contentโ€. It seems that ZatcaEGS is trying to access the managerโ€™s api via http instead of https. I started the ManagerServer with port 8080 and tried 80 ,too . I made sure to allow port 443 with no luck.

image

Again, I appreciate your help.

The script runs on the client side,

Make sure there is no anti-virus or browser extension blocking the script on the client computer.

I used Windows 11, Microsoft Edge, Mozilla and Google Chrome, all worked fine.

Hi Mabaega

I identified the cause of the issue and found a workaround. Our Linux server runs ManagerServer on the default port 8080, which uses HTTP and is not secure. When I click โ€œrelay,โ€ the HTTP URL to our server gets embedded within the ZatcaEGS page code, which uses HTTPS. This mismatch causes the mixed content error, preventing the API call.

Solution:
To force ManagerServer to use port 443, I set up a reverse proxy using Caddy, which handles HTTPS connections and forwards them to ManagerServer running on port 8080. (fyi, I treid to run the ManagerServer with port 443 but it failed to start the application)

Step-by-Step Guide:

  1. Install Caddy by running:

    sudo apt update
    sudo apt install caddy

  2. Configure Caddy by editing the Caddyfile to set up the reverse proxy:

    yourdomain.com {
    reverse_proxy localhost:8080
    }

Replace yourdomain.com with your actual domain name.

  1. Start and enable Caddy:

    sudo systemctl start caddy
    sudo systemctl enable caddy

  2. Start ManagerServer on port 8080 or your configured port.

By using Caddy, HTTPS connections on port 443 are handled and forwarded to ManagerServer, ensuring secure access to the application. Do you have a better solution?

The relay is now working, and submissions are successful. However, I encountered another issue, which I will post separately.

Hi Mabaega,

Thank you again for your help and quick response. I can now submit invoices and download the scan code XML to attach to the invoice. However, the image doesnโ€™t seem to change as shown in the snapshot below. The code before and after appears to be the same. How can I fix this?

I look forward to hearing from you

Check if the footer has been added to the invoice

That resolved my issue, thank you very much. However, Iโ€™ve encountered another problem. I plan to use the software for Health Care and need to use VATEX-SA-HEA. When validating the data in the Manager invoice, I receive an error.โ€œ[BR-KSA-49]- If the tax exemption reason code (BT-121) is equal to VATEX-SA-EDU or VATEX-SA-HEA, then the other buyer ID (BT-46) is mandatory and must be national ID (BT-46-1 = NAT).โ€

Where should I enter the buyer ID? Iโ€™ve tried modifying several fields within the customer, such as Tax SchemeID, Tax Number, and code, but without success.

@gwmsist
Thank you for reporting this.

We need an additional Custom fields for Customer to record the PartyIdentification Scheme and PartyIdentificationID.

      <cac:PartyIdentification>
          <cbc:ID schemeID="NAT">XXXXXXXXXX</cbc:ID>
      </cac:PartyIdentification>

Will be fixed in the next release.

Application Update Notification

Update ZatcaEGS to Version v24.12.17.0001

  • Improved Invoice Converter to support inline discounts.
  • Added additional custom fields for Record Identification Scheme and Identification ID.
  • Fixed Invoice Converter to properly handle VATEX-SA-EDU and VATEX-SA-HEA scenarios.

Important Notes:

  1. Please ensure you back up your business data before performing the update.
  2. This update will redirect you to the Business Data Setup page to add the new custom fields.
  3. Check your status in the Compliance Check section. Ensure there are no errors or warnings before reporting your invoices.

For any assistance, feel free to reach out!