Introduction
With the Mplus API, it is possible to send little notification message to the cash register’s screen, when it is in use. Notifications are real-time, so if the cash register is not running, the message will not be shown.
Sending a notification message
<?php
require_once('Mplusqapiclient.php');
$mplusqapiclient = new Mplusqapiclient();
// Initialize the client with your details.
// Then we initialize the variables
$branchNumber = 0; // This means: send to all branches
$terminalNumber = 0; // This means: send to all terminals
$message = 'Hello, this is a message from the API.';
// Then we call the sendMessage() function wrapped in a try/catch block to intercept any exceptions.
try {
if (false !== $mplusqapiclient->sendMessage($branchNumber, $terminalNumber, $message)) {
// Success, we show the existing relation's number.
exit(sprintf('Found existing relation with number %d.', $existing_relation['relationNumber']));
} else {
exit('Unable to send message.');
}
} catch (MplusQAPIException $e) {
exit($e->getMessage());
}
In the cash register, the message will be shown in the upper right corner, like this:
