Skip to content

User Input

METHOD NAME userInput

This method is Cancelable.

Requires state IDLE and during process moves to PROMPT

Description

This method creates a custom menu with a text input field. Once the request is processed, the method waits until the user types a valid value according to the request parameters, a cancel event, or a timeout and responds accordingly.

Parameters

object

  • commandId string REQUIRED
    Id that is used as a reference to cancel the command

  • inputType UserInputType REQUIRED
    The type of input

  • title string
    The title at the top of the screen is displayed to the user

  • body string
    The message body on the screen displayed to the user

  • timeout int
    Time in seconds until a response with a TIMEOUT result is returned.
    Default: 60 seconds. The value must be greater than zero

  • cancelable boolean
    A flag indicates if the user can cancel the operation from the selection screen. Default true

  • minLength int
    The shortest length of string to accept.
    REQUIRED if inputType is NUMERIC, ALPHANUMERIC, EMAIL

  • maxLength int
    The longest length of string to accept.
    REQUIRED if inputType is NUMERIC, ALPHANUMERIC, EMAIL

  • minValue int
    The smallest value of the number to accept.
    REQUIRED if inputType is NUMBER

  • maxValue int
    The biggest value of the number to accept.
    REQUIRED if inputType is NUMBER

Result

object on when the request is valid and the menu prompted on the device.

  • commandId string
    Echo back the id from the request

  • result Result
    Possible results are: OK, CANCELED, TIMEOUT
    (1) Show values

    1. Result

      Result of new request. Each command has possible values in the field.

      • OK Request is ok
      • GENERAL_ERROR An error occurred
      • CANCELED Command was canceled either by the user (on-screen) or through cancel command,
      • TIMEOUT Operation was timed out.
      • HOST_ERROR Host returned an error regarding the request.
      • SMART_READER_ERROR An error occurred with the smart-reader
      • SMART_CARD_ERROR An error occurred with the smart card, or the reader couldn't communicate with the card.
      • NONE_CREDIT_CARD Industrial card was detected when performing a transaction.
      • CARD_NOT_ALLOWED When the detected card is not allowed to be processed
  • inputType UserInputType Echo back the input type

  • userInput string
    The input string that was typed. This value is populated if inputType is NUMERIC, ALPHANUMERIC, or EMAIL.

  • intUserInput int
    The input integer that was typed. This value is populated if inputType is NUMBER.

Errors

  • MissingParams
  • InvalidParams on incorrect OTP
  • IllegalState

Example

example

Request

{
  "jsonrpc": "2.0",
  "id": "1234567890",
  "method": "userInput",
    "params": {
        "commandId": "7d516d9c",
        "title": "Type your phone",
        "body": "Type your phone number below",
        "timeout": 30,
        "inputType": "NUMERIC",
        "minLength": 9,
        "maxLength": 10
    }
}

Response

{
  "jsonrpc": "2.0",
  "id": "1234567890"
    "result": {
        "commandId": "1e3206c1-1329-4bec-b846-aa9ebf2c74b9",
        "inputType": "NUMERIC",
        "result": "OK",
        "userInput": "0541234567"
    }
}