API Reference

Basic ERP workflow implementation

The e-invoicing Phase 2 API can be integrated in any ERP such as Netsuite, Microsoft Dynamics, SAP, Odoo, Xero and more.

The following is a possible workflow implementation for B2B invoices or credit notes:

  • On the invoice page in the ERP, the user would see a new Report to ZATCA button.
  • When user clicks the Report to ZATCA button, your implementation would call our Report Invoice API endpoint
  • The Report Invoice API endpoint will report the invoice to ZATCA synchronously, and return the signed QR code, or return validation errors.
  • Your implementation would show a Successfully reported status to the user if reported successfully, or display the validation errors to the user can correct the invoice. If successfully reported, save the id returned by the endpoint in the database. You can use the id in the future to retrieve the invoice from Wafeq's systems, for example if you need to download it or send it to the customer.
  • (Optional) Offer the user a button to download the invoice PDF. Your implementation would call the Download Invoice endpoint to download the PDF.
  • (Optional) Offer the user a button to Send the invoice to the customer by email. Your implementation would call the Send Invoice endpoint to send the invoice by email to the customer.

📘

When to create ledger journals

We recommend you create ledger journals after the invoice has been reported successfully. Otherwise, you might end up with an invoice posted to your ledger that you can no longer modify, but that has failed to be reported – for example because some ZATCA-required fields were missing.

The same applies to credit notes.