libecodsdk, the JSON-RPC API is used by the EMV Core logs and is very useful during integration debugging.
Protocol Rules
Syntax Rules
All commands follow these formatting conventions:- All commands and events use the JSON-RPC 2.0 protocol with named parameters.
- All commands and events require a response, except
log()andReaderMessageEvent(), which have noid. - Message format:
- Use a different
idfor each command (e.g., a running counter) to aid synchronization. - An illegal command returns a
"Not existing command"response from the EMV Core.
Send & Receive
Sending a message:- Send the JSON-RPC message.
- Wait for the JSON-RPC response.
- Once data starts arriving, wait for a complete JSON (all parentheses closed), or a 1-second timeout.
- Wait for incoming data.
- Once data starts arriving, wait for complete JSON, or a 1-second timeout.
- Parse and process the message as JSON-RPC.
- Send a JSON-RPC response (no response needed for
ReaderMessageEvent; no response is sent forsocket_data_received).
Payment Flow
A typical payment session follows this sequence:- POS sends
PreAuthorize. - EMV Core responds (after card tap and authorization) with
TransactionComplete. - POS sends either
ConfirmTransaction(product delivered) orVoidTransaction(otherwise). - POS may send
CancelTransactionat any time;TransactionCompletewill return with statusCancelled.
- Always close a
PreAuthorizesession with Confirm or Void/Cancel. An unclosed session will be reversed by the processor after some time, which may incur higher fees. - Once
ConfirmTransactionhas been acknowledged by the EMV Core, do not re-send it. - To force synchronous processing, set
PAYMENT_SVC_SYNCHRONOUS=1.


Closed Loop (CLP) Flow
For pre-paid cards, EMV Core immediately returns the card UID to the host application viaTransactionComplete without sending to the Nayax server.

Commands
PreAuthorize
Pre-authorize a card with the payment processor. The EMV Core waits for a card, reads it, processes it, then sendsTransactionComplete.
Example:
| Parameter | Description |
|---|---|
amount | Amount to charge in full units (dollars, not cents) |
currency | ISO 4217 code (e.g., 840 = USD) |
productID | Optional: product ID selected by consumer, saved in server for reports |
continuous | If true, poll for card restarts immediately after timeout; TransactionComplete returns PollContinuous |
timeout | Maximum seconds to wait for a card. Returns Timeout status if no card arrives. |
ConfirmTransaction
Confirms the pre-authorization so the payment can settle. Example:| Parameter | Description |
|---|---|
Amount | Actual amount to charge in minor units (cents) |
transactionReference | TransactionDbID from the TransactionComplete event |
productID | Optional: product ID, saved in server for reports |
terminal_data | Optional: terminal_data=(key1=value1,key2=value2); passed to PSP in online requests |
VoidTransaction
Void a transaction in two cases:- Transaction was pre-authorized but not confirmed, to release reserved funds.
- Transaction was completed but needs to be canceled (e.g., product not vended).
| Parameter | Description |
|---|---|
transactionReference | Transaction reference from the TransactionComplete event |
VoidTransaction does not return an event. Check voided transaction status in TMS by searching for Cancel and Cancel Declined statuses.
CancelTransaction
Cancels the last transaction started byPreAuthorize:
- Card not yet presented: Stops the reader poll sequence. The display shows “Cancelling”; the host application must update the display.
- Card already presented but not completed: Returns
CannotCancel.TransactionCompletearrives after the online authorization result. - Transaction already completed: Returns
NoTransaction. - For
CannotCancelorNoTransaction, useVoidTransactionto undo a successful transaction. - If
TransactionCompletereturnsDecline, noVoidTransactionis needed.
GetCardToken
Returns a card token without performing a payment transaction. ReturnsCardTokenReceived event.
- For payment cards: returns a base64 card token.
- For CLP (e.g., Mifare) cards: returns the card UID.
| Parameter | Description |
|---|---|
timeoutSeconds | Maximum seconds to wait. Maximum value: 60 seconds. |
- Requires tag
DFA155added to the reader’s Clear results tag list. - CLP card UID is returned only when
CLP_MIFARE_ENABLED=2.
GetStatus
Returns the current EMV Core status. Example:{NotReady, Ready, PaymentTransaction, Update, NoReader, NoTerminalId}
ShowMessage
Shows a message on the OTI Saturn Reader display. Example:| Parameter | Description |
|---|---|
line1 | Text for line 1 of the reader display (max 16 characters) |
line2 | Text for line 2 of the reader display (max 16 characters) |
GetVersion
Returns the version of components in the system. Example:| Parameter | Values |
|---|---|
component | otiKiosk (for EMV Core version) or Reader |
GetKioskID
Returns the Kiosk identification number. Example:GetAttribute
Returns the value of an EMV Core configuration attribute. Example:Events
TransactionComplete
Sent by the EMV Core when a transaction completes (success or failure). Contains all data needed for receipts and dispute resolution. Note: If no acknowledgment is received, the EMV Core resends up to 2 times (3 total). If still no answer, it assumes the message was received and does not cancel the transaction. Example (open loop):| Field | Description |
|---|---|
status | OK, Declined, Error, Timeout, Cancelled, LocalCLP |
errorCode | Numeric error code (0 = no error; positive = PSP errors; negative = OTI system errors) |
errorDescription | Technical error description for developers; do not display to users |
transactionId | Use for ConfirmTransaction or VoidTransaction |
| Field | Description |
|---|---|
AmountAuthorized | Amount approved in major units (may be lower for prepaid cards) |
AmountRequested | Amount requested in major units |
Authorization_Code | PSP transaction identifier for approved transactions |
PartialPan | Masked PAN (first 6 and last 4 digits) |
CardType | Card scheme (MasterCard, Visa, Amex, etc.) or closed-loop card technology |
IsTransactionApproved | Boolean approval status |
eReceipt | URL for Nayax eReceipt |
Card_ID | Mifare UID when CLP_MIFARE_ENABLED=2 |
RRN | Processor reference number for approved transactions |
CardToken | Base64 token for payment cards; card UID for closed-loop cards |
Additional_Parameters | Optional fields for Nayax External Settlement: SiteId, EntryMode, MachineAuTime, NayaxTransactionId |
| Card Type | Description |
|---|---|
Type A | ISO/IEC 14443 Type A |
Type B | ISO/IEC 14443 Type B |
Mifare | Mifare |
Mifare-U | Mifare Ultralight |
DesFire | Mifare DESFire |
Mifare-P | Mifare Plus |
Vicinity | ISO/IEC 15693 |
Vicinity-P | ISO/IEC 15693 HID iClass |
Felica | FeliCa JIS X 6319-4 |
CLP | Unknown closed loop |
CardTokenReceived
Sent whenGetCardToken is completed.
Example:
ReaderMessageEvent
Sent when the display message on the Saturn Reader changes. Use this to synchronize the kiosk application with reader state. Note: Requires the reader to be configured to send External Display message events (Tag DF 46 with index 04). This event does not require acknowledgment. Example:| Hex | Decimal | Message | LED |
|---|---|---|---|
| 0x01 | 1 | Present card | LED1 On |
| 0x11 | 17 | Welcome | LED1 Blink |
| 0x05 | 5 | Please present one card only | — |
| 0x33 | 39 | Read error — Please try again | — |
| 0x24 | 36 | Authorizing — Please wait | Chasing LEDs |
| 0x06 | 6 | Approved | — |
| 0x09 | 9 | Not Approved | — |
| 0x30 | 30 | Timeout — No Card | — |
| 0x26 | 38 | Insert Card | — |
| 0x0A | 10 | Terminated | — |
| 0x0B | 11 | Contactless fail — PIN required | — |
| 0x0C | 12 | See Phone | — |
| — | 255 | Declined | — |
Network Protocol
Socket API
socket_connect
Opens a TCP socket to a remote host.socket_send
Sends data in binary form. Blocks until data is sent.hex_data is a hex-encoded string (2 ASCII characters per byte).
socket_recv
Receives data from a socket. Returns hex-encoded data.socket_close
socket_data_received (event)
Sent by the host when data is available on an open socket. The device does not respond.Network Management APIs
network_get_status
Returns"on" if network is available.