Skip to main content
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# SDKs OnlyThe interface described on this section is relevant for the Java and C# SDKs only.
The vend_callbacks_t interface is designed to handle events related to vending operations.
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.

Vending Events Enumeration

C SDK OnlyThe enumeration described in 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.
C

Enumeration Methods

Below is a list of methods available when using the vend_callbacks_t interface:

Why onVendDenied Carries No Reason

onVendDenied tells your peripheral that the vend was denied, but never why. That is deliberate. The machine is unattended, and surfacing a reason such as a blocked card on a public screen would embarrass the consumer. The same applies to insufficient credit: the device does not show it and the SDK logs do not record it, because it concerns the exchange between the device and the acquirer rather than the exchange between the device and your machine. You can see the reason a card was rejected or a transaction was cancelled in Nayax Core.

Approve a Card with a Third-Party Server

When your peripheral authorizes proprietary cards against your own server, the flow runs outside the SDK up to the point of the verdict. After the Vend Request is sent and the consumer presents a card, the device sends the Transfer Data command. Your peripheral receives the card details and forwards them to your server on its own. Once your server approves or denies the card, the peripheral reports the verdict back through client_gateway_auth, which also informs the device.
The demo apps simulate an approved card by returning true:

Cancel a Vend Request

Once you have sent a Vend Request and have not yet received Vend Approved or Vend Denied, you can send the Cancel command. It causes Vend Denied to be sent. If Vend Approved was already on its way when you sent Cancel, the cancel does not appear in the logs, because a cancel cannot follow a Vend Approved. The peripheral sends Vend Failure instead. Responding with Vend Failure directly, without using Cancel, gives the same result. You can also cancel before sending the Vend Request, when a consumer starts a transaction and then backs out. That covers both the case before a card is presented and the case just after Begin Session arrives but before you send the Vend Request. In the first case, the SDK log shows only reader enable.