> ## Documentation Index
> Fetch the complete documentation index at: https://nayax-44d6e37b-docs-marshall-faq-redistribution.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Vending Session Management

This page covers the data structures used in the Marshall SDK to handle vending product requests and sessions. Such as:

* `vend_item_t`
* `vend_session_data_t`
* `vend_session_t`

These structures define the classes and fields necessary to manage product details, session data, and the overall vending session.

## Product Class

The `vend_item_t` class represents an individual product request within a vending session. This class includes the product code, price, quantity, and unit of measure. The following code block lists all class parameters:

<CodeGroup>
  ```java Java theme={null}
  public static class vend_item_t {
      public short code;
      public int price;
      public int qty;
      public byte unit;
  }
  ```

  ```csharp C# theme={null}
  public static class vend_item_t {
      public short code;
      public int price;
      public int qty;
      public byte unit;
  }
  ```

  ```c C theme={null}
  struct vend_item_t
  	uint16_t code;
  	uint16_t/uint32_t price;
  	uint32_t qty;
  	uint32_t unit;
  ```
</CodeGroup>

### Product Parameters

The table below provides a more detailed description of the parameters.

| Parameter | Type (inferred) | Description                                                                                         |
| :-------- | :-------------- | :-------------------------------------------------------------------------------------------------- |
| `code`    | String or Int   | The unique identifier for the product, also known as the MDB code.                                  |
| `price`   | Int             | Product price, where the real price is calculated as price / (10 ^ decimal places).                 |
| `qty`     | Int             | The quantity of the product being vended.                                                           |
| `unit`    | Int             | Unit of measure for the product, with `0` indicating a discrete unit (e.g., a single drink bottle). |

## Vending Session Data Class

The `vend_session_data_t` class holds detailed information about a vending session, including transaction details and card information. The following code block lists all class parameters:

<CodeGroup>
  ```java Java theme={null}
  public static class vend_session_data_t {  
      public long transaction_id;  
      public short choose_product_timeout;  
      public int card_type;  
      public int card_entry_mode;  
      public String card_bin;  
      public String card_bin_hash;  
      public String prop_card_uid;  
      public int vmc_auth_status;  
      public int com_status;  
      public String excel_data;  
      public String cc_last_4_digits;  
  }
  ```

  ```csharp C# theme={null}
  public static class vend_session_data_t {  
      public long transaction_id;  
      public short choose_product_timeout;  
      public int card_type;  
      public int card_entry_mode;  
      public String card_bin;  
      public String card_bin_hash;  
      public String prop_card_uid;  
      public int vmc_auth_status;  
      public int com_status;  
      public String excel_data;  
      public String cc_last_4_digits;  
  }
  ```

  ```c C theme={null}
  struct vmc_vend_transfer_data_t
    int 	 encode_bitmap;
    int       transaction_id_len;
    uint8_t[] transaction_id;
    uint16_t  choose_product_timeout;
    uint8_t   card_type;
    uint8_t   card_sub_type;
    uint8_t   card_entry_mode;
    int     	 card_bin_len;
    uint8_t[] card_bin;
    int     	 card_bin_hash_len;
    uint8_t[] card_bin_hash;
    int     	 prop_card_uid_len;
    uint8_t[] prop_card_uid;
    uint8_t   vmc_auth_status;
    uint32_t  com_status;
    int     	 ftl_data_len;
    uint8_t[] ftl_data;
    char[] 	 cc_last_4_digits;
    uint16_t  product_code;
    uint32_t  product_price;
    uint32_t  default_credit;
    uint8_t[] main_fw_ver;
    uint8_t[] pos_fw_ver
    uint8_t[] monyx_id;
    uint32_t  final_price;
    sint32_t  card_balance;
  ```
</CodeGroup>

### Class Parameters

The table below provides a more detailed description of the parameters.

| Parameter                | Type (inferred) | Description                                       |
| :----------------------- | :-------------- | :------------------------------------------------ |
| `transaction_id`         | String or Int   | Transaction unique identifier.                    |
| `choose_product_timeout` | Int             | Timeout duration for choosing a product.          |
| `card_type`              | String          | Card type used in the transaction.                |
| `card_entry_mode`        | String          | Card entry mode (e.g., swipe, insert).            |
| `card_bin`               | String or Int   | The Bank Identification Number (BIN) of the card. |
| `card_bin_hash`          | String          | The hashed BIN of the card for security purposes. |
| `prop_card_uid`          | String          | The UID of the proprietary card.                  |
| `vmc_auth_status`        | String or Int   | Authorization status from the VMC.                |
| `com_status`             | String or Int   | Communication status.                             |
| `excel_data`             | String          | Additional data in Excel format.                  |
| `cc_last_4_digits`       | String          | The last four digits of the credit card.          |

## Vending Session Handle Class

The `vend_session_t` class represents a vending session, encapsulating session-specific data, product lists, and session status. The following code block lists all class parameters:

```java Java theme={null}
public static class vend_session_t {
    public int funds_avail;
    public int session_status;
    public vend_session_data_t data;
    public ArrayList<vend_item_t> products_list;
}
```

```csharp C# theme={null}
public static class vend_session_t {
    public int funds_avail;
    public int session_status;
    public vend_session_data_t data;
    public ArrayList<vend_item_t> products_list;
}
```

```c C theme={null}
struct vend_session_t
  int funds_avail;
	int total_amount;
	int vend_amount;
	int discount;
	uint16_t session_id;
	vmc_vend_transfer_data_t* data;
	vend_item_t* products;
	int total_products;
```

### Vending Session Class Parameters

The table below provides a more detailed description of the parameters.

| Parameter                  | Type (inferred)           | Description                                                                                                                                          |
| :------------------------- | :------------------------ | :--------------------------------------------------------------------------------------------------------------------------------------------------- |
| `funds_avail`              | int                       | Available funds for the session.                                                                                                                     |
| `session_status`           | String or Enum            | The user sets the session's status, especially in cases of cancellation or failed dispensing.                                                        |
| `vend_session_data_t data` | Object                    | An instance of `vend_session_data_t` containing detailed session data.                                                                               |
| `products_list`            | ArrayList\<vend\_item\_t> | A list of `vend_item_t` objects representing the products involved in the session. Note that only a single product is allowed in multi-session mode. |
