Vending Events
Vending events are a crucial aspect of the Marshall SDK, enabling your application to handle various stages of the vending process.
- For Java and the C# SDKs the
vend_callbacks_t
interface defines the set of callback methods that your application must implement to respond to these events. - In the C SDK the
vmc_vend_event_e
enumeration performs the same.
The sections below provide an overview of these events and their respective callback methods.
Vending Callbacks Interface
Java and C# SDK's Only
The interface described on this section is relevant for the Java and C# SDK's only.
The vend_callbacks_t
interface is designed to handle events related to vending operations.
public abstract static interface vend_callbacks_t
Implementing this interface allows your application to manage the lifecycle of a vending session, from initiation to settlement, and handle various statuses and commands received from Nayax's devices. Below is a list of methods available when using the vend_callbacks_t
interface:
Interface Methods
The table below provides a more detailed description of the Methods.
Method | Description |
---|---|
onReady(vmc_link.vpos_config_t config) | 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 configuration details of the VPOS. |
onSessionBegin(int funds_avail) | Triggered when a client presents a credit card, indicating that a new session has begun and funds are available for the transaction. |
onTransactionInfo(vend_session_data_t data) | Called on receipt of transaction data, providing detailed information about the current transaction. |
onVendApproved(vend_session_t session) | Invoked when a vending request is approved. This method should return true if the vendor process was successful, indicating that the client’s credit card will be charged, or false If the vendor process failed. |
onVendDenied(vend_session_t session) | Called when a vending request is denied, allowing the application to handle the denial accordingly. |
onSettlement(boolean success) | Triggered when a transaction settlement occurs, indicating whether the settlement was successful. |
onStatus(int status) | Called when the peripheral receives a Status command from Nayax's device, providing the current status of the session as defined in the Marshall Protocol section 8.11. |
onOpenedSessions(ushort[] sessions) | This is invoked when the peripheral receives a Get Session Status command from Nayax's device. It helps identify which sessions are open, especially in multi-session mode. (See Marshall Protocol section 8.27.5) |
onReaderState(boolean enabled) | Provides the status of the reader, indicating whether it is enabled or disabled. (See Marshall Protocol section 8.27.9) |
onRemoteVend(int avail_funds, int product_code, int options) | Triggered when the device receives a remote vend command, providing the available funds, product code, and options for dispensing the product. |
onReceipt(int ereceipt_type, String data) | Called when a QR code receipt is generated, passing the QR code data to the peripheral to display for the consumer. (See Marshall Protocol section 8.12) |
Vending Events Enumeration
C SDK Only
The enumeraion described on this section is relevant for the C SDK only.
The vmc_vend_event_e
enumeration is designed to handle events related to vending operations in the C SDK.
Enum vmc_vend_event_e
Enumeration Methods
Below is a list of methods available when using the vend_callbacks_t
interface:
Method | Description |
---|---|
onReady(vend_session_t session) | Called when the peripheral framework is ready to start a session. This occurs after a link has been established or a previous session has ended. |
onSessionBegin(int fundsAvail) | Called when a client presents a credit card, providing the available funds for the transaction. |
onTransactionInfo(vend_session_data_t data) | Triggered when transaction data is received, passing detailed information about the current session. |
onVendApproved(vend_session_t session) | Called when a vending request is approved, providing session details for further processing. |
onVendDenied(vend_session_t session) | Called when a vending request is denied, passing relevant session details. |
onSessionCanceled(vend_session_t session) | Triggered when a transaction is canceled, providing information about the canceled session. |
onSettlement(uint32_t success) | Indicates the settlement status of a transaction. The success parameter indicates whether the settlement was successful (non-zero for success). |
onStatus(uint32_t status) | Called when the peripheral receives a Status command from Nayax's device. (See Marshall Protocol section 8.11) |
onSessionsResponse(mdb_msg_sessions_status_t sessions) | Triggered when the "Get Session Status" command is received from Nayax's device. Provides details about open sessions, helpful in multi-session mode or after a software restart. |
onReaderStateResponse(mdb_msg_reader_status_t state) | Responds to the "Get Reader Status" command, indicating whether the card reader is enabled or disabled. (See Marshall Protocol section 8.27.9) |
onReceipt(int ereceiptType, String data) | Called when a QR code receipt is generated. Passes the QR code data to the peripheral to display for the consumer. (See Marshall Protocol section 8.12) |
onSessionTimeout(uint32_t sessionId) | Triggered when a transaction times out, providing the sessionId of the timed-out session. |
Updated 1 day ago