Skip to main content

Overview

The EMV Core provides the POS application with two API layers:
  1. C functions implemented in libecodsdk. See ecod_sdk.h and ecod_sdk_types.h in the SDK.
  2. JSON-RPC messages with Datalink wrapper over Serial or USB. See JSON-RPC API.
The POS application manages the user interface, using reader state events from EMV Core to keep the display in sync with the current payment status (idle, authorizing, declined, approved, etc.).

Supported Functionality

The SDK supports the following payment and device management operations:
  • Credit / Debit / Pre-paid Cards Sale:
    • EMV Contactless (NO CVM only)
    • Two-step transaction (Authorize → Confirm)
    • Closed-loop (pre-paid) cards
    • Synchronous (single session) and Asynchronous (multi-session) flows
  • Cancel and Void Transaction:
    • CancelTransaction cancels an active poll before a card is captured.
    • VoidTransaction reverses a transaction that was already approved.
  • User Interface (UI): Managed by the POS application using Reader state events.
  • Terminal Management: Firmware and configuration updates, status and version queries, Device ID.
  • Network API: The host must implement the Network API to enable EMV Core communication with Nayax servers.

API Reference

Initialization and Lifecycle

Get SDK version string

Returns the SDK version as a null-terminated string:

Initialize SDK

Call once at startup:

Maintenance loop

Call continuously from a dedicated thread:

Process JSON-RPC messages

Call from a second thread when EC_USE_DATALINK_PROTOCOL=1:
When EC_USE_DATALINK_PROTOCOL is enabled, a second thread is required to process JSON-RPC messages. Call EcodSdk_Maintain() for datalink operations and EcodSdk_ProcessMessages() for message processing.

Set logging verbosity

Call to control the detail level of SDK log output:

Device Status

Get current device status

Call to query the current device state:

Get device identification (serial number) and versions

Call to retrieve the device serial number and firmware version strings:

Read configuration attribute

Returns the value of a named key from the active configuration file:

Transaction Operations

Start pre-authorization

Reserves the amount; must be confirmed or voided later:

Request card token without charging

Starts card polling without initiating a payment:

Confirm a pre-authorized transaction

Call after the product or service has been delivered:

Void a pre-authorized transaction

Call to release a pre-authorized hold without charging the card:

Cancel ongoing payment process

Call to stop an active card poll before authorization completes:

Network Notifications

These functions are called by the platform layer to notify the SDK of network events:

Notify EmvCore of socket data arrival

Call from the platform layer when data is available on a socket:

Notify EmvCore that socket was closed

Call from the platform layer when a socket connection has been closed:

Notify EmvCore of network connectivity change

Call from the platform layer when the network becomes available or unavailable:

Callback Registration

Transaction completion (success, decline, error, cancel, timeout)

Register a handler to receive the result of every PreAuthorize call:

Reader display events (customer prompts)

Register a handler to receive the current message displayed on the reader:

Key Data Types

Payment Parameters

Pass this struct to EcodSdk_PreAuthorize and EcodSdk_GetCardToken:

Transaction Response

This struct is passed to the TransactionComplete callback:

Status Codes

Device status (from EcodSdk_GetStatus):
API return codes:
Transaction status:

Amount Field Details

Amount fields use different units depending on the API method:
  • C API: amount_cents in emvCorePaymentParameters and the amount argument in EcodSdk_ConfirmTransaction are always in cents (e.g., 450 = $4.50).
  • JSON-RPC PreAuthorize: amount is in major units (e.g., 4.50 = $4.50).
  • JSON-RPC ConfirmTransaction: amount is in cents (e.g., 450 = $4.50).
  • The amount fields in the TransactionComplete event are returned in major units (e.g., 4.50 USD) as received from the PSP.
  • The fee parameter is deprecated. Set it to 0. It will be removed in the next SDK version.

Currency Code Management

The SDK resolves the currency code from multiple sources in priority order:
  • From SDK v1.0 onward, the currency code is taken from the CURRENCY_CODE attribute in the EMV Core configuration.
  • If CURRENCY_CODE is missing from the configuration, the currency parameter sent by the host in PreAuthorize is used (backward compatibility).
  • If neither is provided, the EMV Core software default (840 / USD) is used and an alert is sent to the Nayax Core server.
  • When the device is managed from Nayax Core, the currency code is automatically taken from the machine settings.