A smart coffee machine

We created a simulation to show how Cloud Wallet works. It’s a “vending machine that never runs out of coffee.” Our API will keep a record of coffee production, sales and inventory restocking for the machine.

Play this demo to discover how it works.

Under the hood

Let's break a purchase of a freshly brewed coffee down into three simple steps:

Payment is accepted Ingredients are consumed A cup of coffee is made and delivered to the customer

After integrating Cloud Wallet API with the vending machine, we can model this process as a complex transaction that will affect multiple wallets.

Setup

Wallet is like an account. It records the currently available amount (balance) of something valuable (an asset), as well as all incoming (credit) and outgoing (debit) movements of value.

For the machine, we have opened five wallets: four dealing with expenses (inventory) and one for revenue (cash from sales). To brew a cup of coffee, the vending machine needs a set of ingredients like water, coffee beans, milk, and paper cups. All these are “inventory” - types of assets that can be accounted for. We open a wallet for each ingredient to store the available remaining amount. Inventory is consumed (eliminated) during the brewing process and a cup of coffee is produced and given to the customer. In exchange, our system collects payment that appears in the cash wallet.

Initially, the machine is pre-loaded with all the necessary ingredients. Each available drink type has its own price and uses up a different amount of ingredients.

How does it work?

Purchase. We modeled a purchase as a complex transaction. First, it consumes the required amount of each ingredient by removing ("redeeming") value from its wallets. Second, it creates ("issues") value and adds it to the cash wallet as a reflection of accepted payment. Purchase any drink and you will see that the balances of the ingredients have been reduced and the cash balance has increased. On the right side, you will see a new transaction has been posted. It will contain one green line and three to four red lines reflecting the creation and disposal of value.

Refill. A supplier will restock ingredients and collect payment for them. Since the machine itself is not equipped with a cash dispenser, the payment will be accounted for and then carried out sometime later. The transaction for a restock will, of course, create some value in the inventory wallets. On the other hand, the payment will be recorded as a transfer from the revenue wallet to the supplier's own wallet. In the transaction log, you will see a few green lines and one red arrow that reflect these operations. Each complex transaction will follow one basic rule: the whole transaction will be completed only if each operation in it can be performed. Should any single operation be impossible, the whole transaction will fail without affecting any wallet. This, for example, makes it impossible to brew anything except black coffee if the machine runs out of milk.

Conclusion. By having the Cloud Wallet integrated with the vending machine, you can record the internal economics of your vending machine. This, for example, enables you to optimize your stock and increase your bottom line.

Do you have an idea of how Cloud Wallet can help your business? Share it with us!
Share it with us!
Contact us

Your privacy

We use cookies to improve your experience in our site and to show you personalised advertising. To find out more, read our privacy policy and cookie policy