> ## Documentation Index
> Fetch the complete documentation index at: https://devzone.nayax.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 预选单场会议

本指南将详细介绍**预选**自动售货流程。您将了解在单笔交易中完成商品选择和支付授权的各项步骤，从而确保流畅安全的售货体验。

## 付款流程

下图展示了预选过程，说明了从产品选择到付款授权和发货的单次自动售货会话流程的每个步骤。

<Frame>
  <img src="https://mintcdn.com/nayax-44d6e37b/SZdrogZN6xHGu-sq/images/docs/marshall-single-session-with-pre-sel/image1.png?fit=max&auto=format&n=SZdrogZN6xHGu-sq&q=85&s=fb1d802480d331ce69bc325385d14675" width="1706" height="1786" data-path="images/docs/marshall-single-session-with-pre-sel/image1.png" />
</Frame>

以下是该图的细分：

1. Nayax 设备向消费者发送消息：“请选择产品。”
2. 消费者从自动售货机中选择产品。
3. 外围设备的 SDK 向 Nayax 设备发送售货请求。

   <CodeGroup>
     ```c C theme={null}
     vmc_vend_vend_request(vend_session_t *session)
     ```

     ```csharp C# theme={null}
     vmc_instance.vend.vend_request(session);
     ```

     ```java Java theme={null}
     m_vmc.vend.vend_request(m_sessions[m_active_session]);
     ```
   </CodeGroup>
4. Nayax 设备向消费者发送消息：“请出示卡。”
5. 消费者出示支付卡。
6. Nayax 设备向 Nayax 服务器发送授权请求。
7. Nayax 服务器将授权请求转发给计费提供商。
8. 计费提供商向 Nayax 服务器发送授权响应（已批准）。
9. Nayax 服务器将授权响应（已批准）发送回 Nayax 设备。
10. 外围设备的 SDK 处理通过传输数据命令从 Nayax 设备接收的交易数据（所述数据包括有关 Nayax 交易 ID 和消费者卡详细信息的信息）：

    <CodeGroup>
      ```c C theme={null}
      vmc_vend_event_handler_cb(vm_vend_event_on_transaction_info)
      ```

      ```csharp C# theme={null}
      vend_callbacks(onTransactionInfo(data))
      ```

      ```java Java theme={null}
      vmc_vend_events()
      (via onTransactionInfo(data))
      ```
    </CodeGroup>
11. SDK 会触发“供应商已批准”事件：

    <CodeGroup>
      ```c C theme={null}
      vmc_vend_event_handler_cb(vm_vend_event_on_vend_approved)
      ```

      ```csharp C# theme={null}
      vend_callbacks()
      (via onVendApproved(session))
      ```

      ```java Java theme={null}
      vmc_vend_events()
      (via onVendApproved(session))
      ```
    </CodeGroup>
12. 外围设备向消费者分配产品/提供服务。
13. SDK 报告“供应商成功”：

    <CodeGroup>
      ```c C theme={null}
      vmc_vend_vend_status(&session, __true)
      ```

      ```csharp C# theme={null}
      vmc_vend_events()
      (via onVendApproved(session) -which would return "true")
      ```

      ```java Java theme={null}
      vmc_vend_events()
      (via onVendApproved(session) -which would return "true")
      ```
    </CodeGroup>

    并完成销售会话：

    <CodeGroup>
      ```c C theme={null}
      vmc_vend_vend_session_complete_lowlevel()
      ```

      ```csharp C# theme={null}
      no such function in C# or Java due to the nature of the languages
      ```

      ```java Java theme={null}
      no such function in C# or Java due to the nature of the languages
      ```
    </CodeGroup>
14. 致消费者的信息：“请取走产品。”
15. Nayax设备向Nayax服务器发送结算请求。
16. Nayax服务器将结算请求转发给计费提供商。
17. 计费提供商向 Nayax 服务器发送结算响应（OK）。
18. Nayax服务器返回结算响应（OK）给Nayax设备。

## 参见

<Columns cols={3}>
  <Card icon="link" title="付款流程" href="/docs/integrate-pos-device/marshall/payment-flows/marshall-payment-flows" arrow />

  <Card icon="link" title="开始" href="/docs/integrate-pos-device/marshall/get-started/marshall-get-started" arrow />

  <Card icon="link" title="方法和功能" href="/docs/integrate-pos-device/marshall/methods-functions/marshall-methods-and-functions" arrow />
</Columns>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.