Link and Events Configuration

This page will explore the essential components and configurations needed to establish and manage the connection between your application and Nayax's payment devices using the Marshall SDK. This includes:

  • Handling events through the vmc_link_events_t interface.
  • Understanding the structure of vpos_config_t.

See the following sections for more details.

Link events

The vmc_link_events_t interface defines the events related to the communication link between the vending machine controller (VMC) and Nayax devices. Implementing this interface allows your application to respond to critical events during the device's operation. The following code block presents how to add the interface:

public interface vmc_link_events_t
void onReady(vmc_link.vpos_config_t config);
void onCommError();
public interface vmc_link_events_t
void onReady(vpos_config_t config);
void onCommError();

Where:

  • void onReady();: This method is called when the link with the VPOS (Vend Point of Sale) is successfully established and the device is ready for vending operations. It provides the VPOS's configuration details.
  • void onCommError();: This method is invoked when there is a communication error between the VMC and the VPOS, enabling your application to handle such errors appropriately.

VPOS configuration structure

The vpos_config_t class encapsulates the configuration settings for the VPOS, which are communicated between the VMC and the device. The following code block lists all available configurations:

public static class vpos_config_t 
      public byte   prot_ver_major;
      public byte   prot_ver_minor;
      public byte   language;
      public byte[] country_code;
      public byte[] currency_code;
      public byte   decimal_place;
      public byte[] vpos_serial;
      public int    machine_type;
      public byte[] merchant_id;
      public byte[] acquirer_terminal_id;
      public byte[] machine_location;
vpos_config_t
	uint8_t 	 language;
	uint8_t[] country_code;
	uint8_t[] currency_code;
	uint8_t   decimal_place;
	uint8_t[] vpos_serial;
	uint8_t[] merchant_id;
	uint8_t[] acquirer_terminal_id;
	uint8_t[] machine_location;

Where:

  • prot_ver_major: The major version of the Marshall protocol.
  • prot_ver_minor: The minor version of the Marshall protocol.
  • language: The language setting of the VPOS.
  • country_code: The country code in ISO format.
  • currency_code: The currency code in ISO format.
  • decimal_place: How the price is represented, as 10 exponents, for example, if the decimal place is 2 and the requested price is 100, then the actual cost is 1.00 (decimal places: 2 positions)
  • vpos_serial : The serial number of the VPOS.
  • machine_type : The type of machine connected to the VPOS.
  • merchant_id: The merchant ID.
  • acquirer_terminal_id : The acquirer terminal ID.
  • machine_location : The location of the machine.

Callback function

To register the callback events for link operations, use the following method:

public vmc_link set_events(vmc_link_events_t events);
void vmc_link_register_callback(vmc_vend_event_handler_cb_t cb)

By understanding and implementing these configurations and methods, you can effectively manage the communication link and event handling for Nayax payment devices, ensuring reliable and efficient vending operations.