Influencing User Flow with Dialog Options

Introduction

In some situations, you may want to provide the user with a dialog, e.g. to have them make a decision or select an option. You can do this by replying to a blocking webhook call with the following response:

Property Type Explanation
dialog.required boolean Is a choice required?
dialog.allowMultipleOptions boolean Is more than one choice allowed?
dialog.dialogTitle string Which title should the dialog show?
dialog.dialogOptions[].optionId int The option’s ID.
dialog.dialogOptions[].optionName string The option’s textual description.

You can have the user select zero, one or more options by using the required and allowMultipleOptions properties.

Sending this response will cause a dialog to open in MplusKASSA that looks something like this:

In this example, the first dialog option has been selected. After the user clicks Confirm MplusKASSA will send a new request to your endpoint with the same event data, but this time the selected dialog option(s) will be included in the JSON body.

Property Type Explanation
dialog.selectedDialogOptionIds int[] Array of the selected dialog option ID’s.

Based on this new data, you can now process the selection and optionally reply with the action you want MplusKASSA to perform. E.g. applying an external discount.

startPayment Example of showing a dialog and performing an action based on the result

Request
This example is based on a session containing 2x Coffee and 1x Cake.

Response
The dialog presents the cashier with a choice of voucher to apply.

At this point, the cashier can make a choice for zero or one voucher, because required is set to false and allowMultipleOptions is also set to false.

Request after selection
After a selection has been made, an event with the same details will be sent, but this time containing the selection.

Response after selection
You can now apply the selected voucher to the relevant line(s) based on the selected dialog option(s).

Property Type Explanation
lineChanges.lineId uuid The UUID of the session line that you want to change.
lineChanges.externalDiscount.discountId uuid This is a 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.