The TruModule Example projects are available for partners and customers from TruRating. The source code is open source under the MIT license and is available in github.

The Example code assumes the payment application architecture illustrated in the figure below. It is recognised that this is not an accurate reflection of any one payment application. It is intended to be generally applicable in a way that can be used to identify the key elements of relevance to a TruModule implementation. A description of each of these main components follows.

All example code is provided for reference purposes only and may not be suitable for production

Example code architecture
Logical architecture for the TruModule example implementations

Payment application

In this example TruModule is incorporated as a new component into an existing payment application that has control of the screen and keypad of a PIN entry device (PED), either the device it is resident on, or a slave device that is connected to the POS.

The payment application maintains the following significant existing interfaces:

  • A POS interface that allows it to receive payment request messages and return authorisation responses.
  • A payment kernel that is responsible for processing the card payment.
  • A network interface to an online payment authorisation service.
  • A device driver interface that allows it to control the PED.
  • A method for assembling and delivering the data that will eventually be available for printing on the receipt.

The PED driver and receipt manager are collectively viewed as an “IDevice” from the perspective of the TruModule code.

A message processor is identified to handle incoming messages. When TruModule is present it may receive some messages directly.

POS Interface

The use of the POS interface is normally confined to payment requests. There are systems which support additional messaging and so there may be message queues that buffer the input and output.

TruRating has specified a set of additional messages that describe events occurring in on the till during the POS transaction. This example assumes that the POS interface can be extended to accommodate these messages, and that they will be routed directly to the TruModule.

Payment kernel

The payment kernel is responsible for conducting the card payment processing including the dialog with the card using the services that the IDevice exposes. It may have to contact a payment authorisation service during the transaction.

At the end of the transaction the transaction result is passed to TruModule, with a subset of the transaction data, as well as being sent back to the POS.

IDevice interface

The IDevice interface provides TruModule with a way of calling the 1AQ1KR, display or receipt functions of the device, without having to know the details of how those calls are implemented. The interface includes the following functions that TruModule calls.

    public interface IDevice
        void DisplayMessage(string value, int timeoutMilliseconds);
        short Display1AQ1KR(string value, int timeoutMilliseconds);
        void CancelInput();
        void AppendReceipt(string value);



The TruService interface (TSI) operates using either HTTP or HTTPS, and so these protocols must be supported from TruModule.

Accessing the source code


The TruModule C# source code may be downloaded from the TruRating TruModule C# GitHub repository


The TruModule Java source code may be downloaded from the TruRating TruModule Java GitHub repository


For access to the C++ TruModule implementation please contact TruRating directly.