Building a Code Interpreter
note
This section is currently under active development. Please check back later.
Interpret code request & response
Example request:
{
"code": "abc123",
"context": {
"orderId": "...",
"storeId": "...",
"userId": "..."
}
}
Example response:
{
"owner": true,
"statusCode": "successful",
"code": "abc123",
"actions": [
...
]
}
Response actions
show-modal-dialog
Returning this action shows a modal dialog to the guest. If mixed with other actions, action processing is paused until the dialog is closed.
Action object properties
| Property | Type | Description |
|---|---|---|
type | string | The action type: show-modal-dialog |
title | localizedText | The header shown in the modal dialog. |
message | localizedText | The message shown in the modal dialog. |
buttons | modalDialogButton[] | A list of buttons to show in the modal dialog. |
modalDialogButton object properties
| Property | Type | Description |
|---|---|---|
buttonType | string | The button type. Valid values: primary |
text | localizedText | The button text. |
localizedText object properties
| Property | Type | Description |
|---|---|---|
value | string | A fallback text value used if no applicable translation is found. |
translations | object | A map of culture code (e.g. en-GB) to translated text value. |
Example:
{
"type": "show-modal-dialog",
"title": {
"value": "Welcome!",
"translations": {
"en-GB": "Welcome!",
"sv-SE": "Välkommen!"
}
},
"message": {
"value": "You are now signed in.",
"translations": {
"en-GB": "You are now signed in.",
"sv-SE": "Du är nu inloggad."
}
},
"button": {
"value": "OK",
"translations": {
"en-GB": "OK",
"sv-SE": "OK"
}
}
}
sign-in
Returning this action allows user sign-in as a result of scanning a code.
Action object properties
| Property | Type | Description |
|---|---|---|
type | string | The action type: sign-in |
userId | string | The ID of the user signing in. |
authorizationCode | string | A temporary authorization code generated for the user signing in. See xx for more information. |
Example:
{
"type": "sign-in",
"userId": "abc123",
"authorizationCode": "def456"
}