Issuing TRA receipts from your POS or ERP through a VFD API: a developer’s checklist
For developers and IT teams linking a till, ERP or billing system to TRA: the credentials you need, how to build each invoice, how to retry without creating a second receipt, and which details belong on the printed receipt. Written from PowerVFD’s invoice API documentation.
By the Powercomputers team · 26 November 2026 · 6 min read
The short answer
Your POS or ERP keeps making the sale and hands each one to a VFD, which issues the TRA fiscal receipt and sends back its details. With PowerVFD, that hand-off is a single JSON request to POST /service/v1/invoices, authenticated by an interface code and token placed in the request body rather than in a header. Give every line its VAT-inclusive total and a tax code, and always include your own unique invoice number so that resending can never produce a duplicate receipt. Then print the four details the response gives you: receipt number, Z number, verification code and QR code.
Key points
- The 2025 amendments allow billing systems integrated with TRA’s EFDMS to issue fiscal receipts.
- Invoices go to POST /service/v1/invoices as JSON, and the response is JSON too.
- Each connected system is issued a separate interface code and token, and the token belongs on your server only.
- A unique invoice number on each device makes resending after a timeout safe.
- A batch is saved whole or not at all, so send live sales one invoice per request.
- Every printed receipt needs four details from the response: receipt number, Z number, verification code and QR code.
Where a VFD fits between your software and TRA
The 2025 amendments to the Tax Administration (General) Regulations let a business keep issuing fiscal receipts from its accounting software or automated billing system, as long as that system is integrated with TRA’s Electronic Fiscal Device Management System (EFDMS) and each receipt bears an electronic signature or code that the Commissioner General has approved.
A VFD with an API is the practical way to meet that condition. Your POS or ERP goes on doing the selling, and the VFD takes care of everything that involves TRA.
What to have in hand before you start
Three things come from the PowerVFD side before your developers write any code.
- The address of a PowerVFD server that your system can reach. All requests are sent to that address, the base URL.
- A pair of interface credentials for your system, the fcode and fcodetoken, which the PowerVFD dashboard generates.
- The device number for the TRA registration you will issue against, for example DV03, which you can leave out if the server has a default device set.
Building each invoice
Each sale travels as one object in an invoice array. The object holds the date and time of sale, the payment type, the customer’s ID type and ID, your own invoice number, the device number, the interface credentials and the item lines, and each line gives a description, quantity, tax code and VAT-inclusive amount.
The quickstart in PowerVFD’s API documentation shows a complete request in cURL, Node.js, PHP and Python. PowerVFD’s website also has a free invoice JSON validator, which runs in the browser and checks a request body against the rules below before you send anything.
- Dates use YYYY-MM-DD and times use 24-hour HH:MM:SS. A future date is always refused; an earlier date is accepted only in date order, and only on a device configured for back-dating.
- Customer ID type codes: 1 for a TIN (9 digits), 2 driving licence, 3 voter’s number, 4 passport, 5 NIDA, 6 none.
- Payment type codes: 1 cash, 2 cheque, 3 card, 4 e-money, 5 invoice. With code 5, include your invoice number.
- Tax codes 1 to 5 correspond to TRA categories A to E. Leave the split into net and VAT to PowerVFD, which works it out from the tax code.
Retrying without issuing a receipt twice
Connections drop, and a timeout leaves you not knowing whether the receipt was issued. PowerVFD settles the question through your invoice number, sent as custinvoiceno. No two invoices on the same device may share it, whatever their send status, and a repeat is rejected instead of being quietly accepted.
The rule for your code is therefore simple. When a request times out or hits a server error, resend it unchanged, invoice number included. You will get either a success or the duplicate error, and the duplicate error tells you the first attempt was saved. A validation error is different: correct the request before sending it again. The retries section of the API documentation works through an example.
One invoice per request, or a batch
A single request can carry several invoices, but the whole batch runs inside one database transaction: if any invoice fails validation, nothing in the batch is saved. Batches suit imports and sets of invoices that belong together. For sales at the till, post each invoice on its own, so one bad invoice can’t hold up the others.
Printing the receipt details
The response gives you everything the printed receipt needs. Map the fields as follows, and keep all four with your own invoice record, which lets you reprint the receipt and reconcile it later.
- The RECEIPT NO line takes vfdinvoicenum.
- The Z NUMBER line takes znumber.
- The RECEIPT VERIFICATION CODE line takes rctvcode.
- The QR code is built from rctvnum, the TRA verification link; if the response includes qrcode_uri, you can embed that instead.
Keeping the interface token private
Because the interface code and token travel inside the request body, anyone who can see a full request can see the token. Three habits protect it.
- Call the API only from your server or back-office system. Browser code is out, because anyone can read the token there.
- Give every connected system its own interface, so you can switch one off without affecting the others.
- Don’t write complete request bodies to logs that others can read: the token is inside them.
Checks before going live
Before real sales flow through the integration, work through these points.
- Test with your real product descriptions and customer names. Some special characters are refused, and the error message points to the exact field and character.
- Plan for each error class. A 400 needs a corrected request, 402 points to the device licence, 403 to a user permission and 404 to credentials that were not accepted, while a 500 is a server error you can safely retry.
- If you pass a cashier’s username, PowerVFD applies that cashier’s limits per invoice and per day; plan how your system will show a limit error to staff.
- Be ready for the pending-invoices error: once receipts on a device have gone more than four days without reaching TRA, new invoices are refused until the backlog is cleared.
How Powercomputers can help
PowerVFD is Powercomputers’ own VFD solution. Besides the API, it has its own route for Tally, connects to PTS-2 pump controllers, and offers an Android app and a web sales screen for counters with no other system. It supports per-invoice and per-day sales limits for each user, with reports by user, branch, department, customer, product, device and connected system. Powercomputers has been a TRA-authorised EFD supplier since 2013 and is on TRA’s approved supplier list for both EFDs and VFDs. Tell the team which platform your system runs on and how you sell, and they will help you plan the connection.
PowerVFD connects to TRA, whose system covers mainland Tanzania. In Zanzibar, fiscal receipts go through the Zanzibar Revenue Authority’s Virtual Fiscal Management System (VFMS), so follow ZRA’s requirements for sales there.
Frequently asked questions
No. Credentials travel inside the JSON body as the interface code and token; your system doesn’t log in as a dashboard user at all.
No. Each line goes in as a VAT-inclusive total with its tax code, and PowerVFD derives the net figure and the VAT from those.
The interface code and token were not accepted. Check both values, and confirm that the interface is still active.
Yes. Tally posts to its own route, /service/v1/invoices/tally, which applies the same rules as the main invoice endpoint.
Sources
This guide was written from these pages:
- TRA: The Tax Administration (General) (Amendment) Regulations, 2025, GN 352J (PDF)
- TRA: List of approved EFD/VFD suppliers (PDF)
- Zanzibar Revenue Authority: Virtual Fiscal Management System (VFMS)
- Powercomputers: PowerVFD
- Powercomputers: PowerVFD API documentation
- Powercomputers: TRA VFD Solution
- Powercomputers: EFD Machines

