Create Payments

Once the SDK is running and the connection with the VPOS (the Nayax device) is established (indicated by the onReady() event), the device is ready to handle vending and cashless transactions.

🚧

Integration

If you have not finished the integration process, check the Integrate Nayax page before continuing.

Setting up a Transaction

To learn how to perform a transaction using Nayax Marshall SDK, follow the steps below.

  1. Start by enabling the device for transactions.
    ⦁	m_vmc.vend.session_start(vmc_vend_t.session_type_credit_e);
    
    ⦁	vmc_instance.vend.session_start(vmc_vend_t.session_type_credit_e);
    
    vmc_vend_session_start(vmc_vend_session_type_credit_e);
    
  2. When a client presents a card and it is approved, the onSessionBegin() event is triggered.
    This is the signal for the peripheral, such as the vending machine, to prepare for payment approval.
    m_session = new vmc_vend_t.vend_session_t(2000, 1, (byte) 0, 10);
    
    m_vend_machine.session = new vmc_vend_t.vend_session_t(2000, 1, (byte) 0, 10);
    
    session_product.code = 1;
    session_product .qty = 1;
    session_product.price = 10;
    session_product.unit = 1;
    session->products = &session_product;
    session->total_products = 1;
    

    📘

    Multi-vend Session

    For a multi-vend session , when you are selling multiple items in one transaction, enable the multi_vend_support flag. The session would then include a list of products.

    m_vmc.vend.vend_request(m_session);
    
    m_vend_machine.vmc_instance .vend.vend_request(m_vend_machine .m_session);
    
    vmc_vend_vend_request(session);
    
  3. After the VPOS approves the vending request, the peripheral must notify the SDK that the product has been successfully delivered to the client. This is done by implementing the onVendApproved(...)API and returning one of the following:
    • True : If the vend process is successful, the client's credit card is charged the requested amount.
    • False : For a failed vend process.
  4. Whether it’s a single session or multi-session, the onReady() event will be called upon finishing the vending process, indicating that the device is ready for the next transaction.

    📘

    Multi-Session

    For multi-session configurations, when the session on the peripheral is finished, the user needs to close the session:

    m_vmc.vend.session_close(m_session)
    
    m_vend_machine.vend.session_close(m_vend_machine.session)
    
    vmc_vend_session_close(session)
    

Following these steps ensures that the vending process, from card presentation to product delivery and payment, is handled efficiently and securely using the Nayax Marshall SDK.