Skip to content

Read Card

METHOD NAME readCard

This method is Cancelable.

Requires state IDLE and during process moves to READ_CARD

Description

This method creates a request to read an industry card from the device. According to PCI regulations, an industry card does not hold sensitive data. The process waits until the card is read on the requested interface, a cancel event, or a timeout occurs.

Parameters

object

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

  • 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

  • readMagCard boolean
    Wait for a card on the magnetic reader. Default false

  • readNfcCard boolean
    Wait for a card on the NFC reader. Default false

At least one of readMagCard or readNfcCard must be enabled.

Result

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

  • commandId string
    Echo back the id from the request

  • result Result
    General Error is returned if the card is unable to be read. Possible results are: OK, CANCELED, TIMEOUT, GENERAL_ERROR, CARD_NOT_ALLOWED
    (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
  • cardType CardType The type of interface used to read the card. This value is populated if the result is OK.

  • magData MagData The data related to magnetic card. This value is populated if cardType is MAG.

  • nfcData NfcData The data related to the RF card. This value is populated if cardType is NFC.

Errors

  • MissingParams
  • InvalidParams
  • IllegalState

Example

example

Request

{
  "jsonrpc": "2.0",
  "id": "1234567890",
  "method": "readCard",
    "params": {
        "commandId": "1e3206c1",
        "title": "Cibus",
        "body": "Swipe your Cibus",
        "timeout": 30,
        "readMagCard":true
    }
}

Response

{
  "jsonrpc": "2.0",
  "id": "1234567890"
    "result": {
        "result": "OK",
        "commandId": "1e3206c1",
        "cardType": "MAG",        
        "magData": {
            "track2": "1555500004444444"
        }        
    }
}