Pre-requisites
Before running the C SDK, ensure you configure the following platform-specific elements:- Serial Port Communication: Implement methods for reading and writing bytes from your platform’s serial port, which connects to Nayax’s device. The SDK interacts with the hardware through this serial interface. You must implement the following functions:
drv_usart_rx_byte(): Reads a single byte from the serial port.drv_usart_rx_chunk(): Reads multiple bytes in one operation.drv_usart_get_rx_pending(): Returns the number of pending bytes in the serial buffer.drv_usart_tx_data(): Sends data bytes to the VPOS device.
- Periodic Timer Tick: Implement a periodic timer tick to invoke the
vmc_link_background()function. This function should be called with an interval of 5 ms to 10 ms. Additionally, ensure thecpu_platform_get_time()function returns a continuously incrementing millisecond counter since the system startup. - UART Communication Validation: Verify that the UART communication with Nayax’s device is fully functional.
- Check for proper data transmission and reception.
- Validate that event callbacks are triggered correctly.
Integrate Marshall
To get started with the C SDK, follow these steps. You can refer to the providedmymain.c file for a sample code and guidance on importing necessary namespaces into your project.
-
Instantiate a VMC configuration object:
C
-
Fill in the appropriate fields. The following code block presents a standard configuration:
C
Mandatory FieldsThe customer machine information fields are mandatory for the VMC configuration. These are the
model, serial, hw_ver and the manuf_code. Read more about these fields in VMC Configuration Object.-
Configure the SDK and register to link events.
C
-
Start the SDK and wait for the
onReady()event:C
Implement Payment Flows
As explained in Payment Flows, the Marshall SDK supports various payment flows. The pages below explain how to implement each in your VMC using the C SDK.C SDK Single Session
Process one transaction at a time before the session resets.
C SDK Multi-Session
Run multiple transactions independently for self-service environments.
C SDK Multi-Vend
Let consumers purchase multiple products in a single payment session.
CPU and Memory Requirements
The C SDK has no special hardware requirements. The SDK developer estimates memory usage at around 1KB of RAM, plus a timer tick of roughly 100 lines of code every 5ms. The actual machine code depends on your compiler and platform. It has been run on an Atmel AVR with 2KB of RAM and an 8MHz controller, with plenty left over for the application itself.Update to a Newer SDK Version
To move an existing integration to a newer SDK version, overwrite the previous SDK with the new one and recompile your implementation.See Also
VMC Configuration Object
Configure the parameters and flags that control your peripheral’s behavior.
Methods & Functions
Find reference documentation for all methods and functions in the Marshall SDK.