This is the end-to-end workflow for a standard taxable sale:
1. Create the Sales Invoice Create a Sales Invoice in ERPNext as normal. Ensure:
- A Tax Category is selected on the invoice header.
- The Sales Taxes and Charges table is populated with the appropriate tax template.
- All line items have their HS Codes populated (either auto-filled or manually entered).
2. Verify HS Codes Before submitting, confirm that every line item has an HS Code. Invoices with missing HS Codes may fail at the INCOTEX side, requiring manual re-submission.
3. Submit the Invoice Click Submit (or Amend and Submit for amended invoices). Upon submission:
- The integration fires immediately via the
on_submithook. - The invoice data is packaged into a payload according to the INCOTEX API specification.
- The correct endpoint (inclusive or exclusive) is selected based on the tax configuration.
- The payload is sent to INCOTEX via a secure HTTP POST request.
4. INCOTEX Response If the submission is successful, INCOTEX returns:
- A System Invoice Number (INCOTEX's internal reference ID)
- A CU Invoice Number (the official KRA control unit number)
- A Verify URL for KRA's public verification portal
Successful Response
ERPNext immediately updates the invoice with these values. The is_filed checkbox is ticked, and the Verify URL is stored.
5. QR Code Generation A QR code is automatically generated from the Verify URL and stored on the invoice. This QR code must appear on the printed invoice given to the customer.
6. Print Use a custom print format that includes the QR code field to produce a KRA-compliant invoice printout.
Current Print Format
Note on Print Formats: As of the current release, a standard out-of-the-box print format with the QR code is not yet bundled. Administrators should create a custom print format that references the
verify_urland QR code fields. Frappe's print format builder or Jinja2 HTML templates can be used for this purpose.