6.2.2 Payment service
The payment service is responsible to approve product delivery, for example by receiving coins or charging a credit card or any other needed condition for the delivery of a product, like age. It is also responsible of all money movements between the different payment devices, like using cash to revalue a card system, handling change or overpay. It interacts with the UI, the machine engine, the audit collect and the price service. It may interact with the customer, for example by physically collecting coins or bills or scanning a credit card. It provides information to monitor the Vending Machine. A Vending Machine according to this specification supports exactly one payment service.
The payment service provides its interface by implementing an instance of the PaymentServiceType (shown in Figure 11, defined in 7.8). The payment service requires OPC UA Client functionality to access the machine engine(s) and the primary price service of the Vending Machine.

The PaymentServiceType provides the identification of the payment service in the Identification Object, defined in OPC 10000-100. The configuration of the payment service is provided by the Configuration Object of BaseConfigurationType defined in 7.3. The configuration may be writable via the OPC UA interface to change the configuration of the payment service. The Delivery Object of PaymentServiceDeliveryType defined in 7.9 provides functionality to request a delivery (by the UI) as well as expose the status of the payment of the delivery (displayed by the UI). The PriceInformation Object of PriceInformationType defined in 7.11 provides price information for deliverables of products of machine engines manged by the payment service. The PaymentModes Object of PaymentModesType defined in 7.13 provides information about the different payment systems supported by the payment service and their status, having on Object of PaymentModeType defined in 7.14 per payment system. The Status Object provides the overall status of the payment service defined in 7.22. The optional Components Object of BaseComponentsType defined in 7.4 can provide information about subcomponents of the payment service. The payment service generates Events of VendingAuditEventType to provide audit data.
The payment service receives price information from the primary price service of the Vending Machine using the PriceInformation Object of the price service. It is up to the implementation of the payment service whether the requests of the UI about price information is always forwarded to the price service, or cached in the payment service.
The payment service will need to interface to any other device which can affect the delivery, and these devices are payment devices. Payment service will provide the UI with enough information from the payment devices to define the payment, but the detailed implementation of the process is internal to payment service. It is also possible (and for sure will happen in the transition phase before OPC UA compliant payment devices will be available, the payment service will handle internally legacy coin, bills, cashless devices using proprietary protocols. When this happens, payment service has to act relative to audit collect to provide, in a way which is in line with this specification, all the required information.
But, with OPC UA compliant payment devices, the payment service is responsible only for the delivery approval but not for the effective handling of other payment device related data, like audit and configuration. There is a specific configuration Property (IsEmulated) used to expose if the payment service is internally handling the payment device, or if an OPC UA enabled payment device is available, enabling direct access to payment device configuration and audit events.
The IsEmulated Property enable easy switch for the need, today, to handle MDB (and other legacy protocols) before fully switch to OPC UA compliant devices.
The payment service may supervise the audit collect for operation and reject new requests when the audit collect is not operating correctly using the IsCollectingAudit Variable of the AuditCollectType.