Syrve POS API SDK

Pay-Per-Time Services

Overview

The Syrve POS app can be used not only to sell goods and items but also for services charged per time. Venues, where customers pay per time they spend there (water parks, bowling, anticafés), can be a good example. In this article, we use pool to describe the subject matter.

Start & Stop

You start and stop the service. The system tracks time while the service is running; the «quantity» is growing and thus growing the total amount. When the service is stopped, the time meter is stopped as well. Customers only pay for the playtime.

Customers may choose to pay for a specific time in advance. In this case, the service is paid in full even if customers decide to leave earlier. Suppose a guest buys one hour of pool. In this case, the time limit and the price are set and won’t change, unlike the «quantity», which will grow as time passes. When the limit is reached, the service will stop automatically. Alternatively, customers may choose to pay upon completion of services for the overall playtime. In this case, the time limit is not set, and the time will continue to progress until the maximum permissible duration of 12 hours is reached.

The starting and stopping can be accompanied by an additional action linked to the table where the order is placed. In the case of pool, it can be putting the light on over the table during the playtime: by default, the lights are off, when the service is started, the light turns on, when the service is stopped, the light goes off. This creates a restriction — no more than one concurrently running service per table. For now, this restriction applies to all tables regardless of whether such additional actions are set or not. In later versions, this restriction will not apply to the tables or services with no links to external devices.

Rates

The service price may depend on the day of the week and change with time. There are two rate types:

The time is tracked according to the following rules:

Data Structure

Service

IOrderServiceItem — order item that corresponds to the time-based service. It is located in the IOrder.Items collection together with food items (IOrderCookingItem). A pay-per-time service is given as the (IProduct) product on the menu with the ProductType.Service type and has the IProduct.RateSchedule charging parameters (if charging parameters are not set, the service has no time-based rates and can be added to the order and paid as a regular item).

Key properties of the pay-per-time service:

Service Period

IOrderServiceItemPeriod — a period a service operates at a particular rate, which includes all time intervals under this rate.

Key properties of the service period:

Rate Settings

RateSchedule — charging mode: by service time or by the time of day.

Service Management

AddOrderServiceItem — adding the service to the order.

StartService — starting the service.

StopService — stopping the service. If a guest bill is printed or the order is paid, the service will stop automatically.

Examples

The SamplePlugin included in the SDK shows examples of the service adding, starting, and stopping — [StartService] and [StopService] methods in the EditorTester class:

private static void StartService()
{
    var order = PluginContext.Operations.GetOrders().Last(x => x.Status == OrderStatus.New);
    var serviceProduct = PluginContext.Operations.GetActiveProducts().Last(x => x.Type == ProductType.Service && x.RateSchedule != null);
    var credentials = PluginContext.Operations.GetCredentials();
    var service = PluginContext.Operations.AddOrderServiceItem(serviceProduct, order, order.Guests.Last(), credentials, TimeSpan.FromHours(2));
    PluginContext.Operations.StartService(credentials, order, service);
}

private static void StopService()
{
    var order = PluginContext.Operations.GetOrders().Last(x => x.Status == OrderStatus.New);
    var service = order.Items.OfType<IOrderServiceItem>().Last(x => x.IsStarted);
    PluginContext.Operations.StopService(PluginContext.Operations.GetCredentials(), order, service);
}