Explanation of the event
The scanCode event occurs whenever a code of any kind is scanned in MplusKASSA. This can be a barcode, a RFID chip or a QR code.
When you subscribe to this event, you can specify regex-based filter patterns to only receive certain kind of codes. For example, to receive only barcodes that start with 25, define the pattern 25.*.
When you respond with a recognized-value of true, we will not try to match the scanned code in our own system. This allows you to override our default code scanning behaviour.
scanCode A barcode is scanned
request
This event occurs when a barcode labeled “2512345678901” is scanned at workplace 1.1.
| Endpoint |
|---|
POST https://www.example.com/webhooks/scanCode |
| Headers |
X-Mplus-Subscription-Id: example_subscription X-Mplus-Signature: ZJABi6vnhFEAFQph9aH29+CvlKnIYoH8vFw/oK8fv5w= Content-Type: application/json Accept: application/json |
| Payload |
{
"event": {
"eventBlocking": false,
"eventCounter": 1,
"eventTimestamp": "2017-08-04T16:37:06.225+02:00"
},
"sender": {
"branchNumber": 1,
"workplaceNumber": 1
},
"session": {
"sessionId": "f2fa2d23-8133-417a-a28c-d35728951ef7",
"lines": [
{
"lineId": "c686f63d-46a7-498e-b421-c72e5cb7136b",
"articleNumber": 1,
"priceIncl": 2.50,
"quantity": 1,
"text": "Coffee"
}
]
},
"scanCode": {
"scannedCode": "2512345678901",
"codeType": "barcode"
}
}
|
| Property | Type | Explanation |
|---|---|---|
| scanCode.scannedCode | string | A textual representation of the code that was scanned. |
| scanCode.codeType | string | barcode,rfid,qrcode |
response
In the response, you can show whether or not you recognized the code. But you can also make changes to the session. For example, apply an external discount.
| Headers |
|---|
X-Mplus-Signature: Hw32mfaemYSyRkuGWQigI2HSC9sJx8B7v/uzwy+YuVI= |
| Payload |
{
"scanCode": {
"recognized": true,
"message": "This is customer Jake!",
"customerMessage": "Hi Jake, welcome back! You have 3 available vouchers!",
"relationNumber": 123
},
"lineChanges": [
{
"lineId": "c686f63d-46a7-498e-b421-c72e5cb7136b",
"externalDiscount": {
"discountId": "12551430-7ce9-11e7-bb31-be2e44b06b34",
"discountDescription": "Sample Voucher",
"discountPercentage": 100
}
}
]
}
|
| Property | Type | Explanation |
|---|---|---|
| scanCode.recognized | boolean | Did you recognize the code or not? |
| scanCode.message | text | A message to show on the cashier side. |
| scanCode.customerMessage | text | A message to show on the customer side (displayed if applicable). |
| scanCode.relationNumber | bigint | Specificy to automatically load this relation into the software. The relation must already be present in the MplusKASSA administration. |
| lineChanges.lineId | uuid | The UUID of the session line that you want to change. |
| lineChanges.externalDiscount.discountId | uuid | This is an UUID you generate and store to remember that you applied this discount. |
| lineChanges.externalDiscount.discountPercentage | number | The discount percentage that you want to apply to the line. |
| lineChanges.externalDiscount.discountDescription | text | A descriptive text for the discount. |