Overview
The EMV Core provides the POS application with two API layers:- C functions implemented in
libecodsdk. Seeecod_sdk.handecod_sdk_types.hin the SDK. - JSON-RPC messages with Datalink wrapper over Serial or USB. See JSON-RPC API.
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:
CancelTransactioncancels an active poll before a card is captured.VoidTransactionreverses 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 whenEC_USE_DATALINK_PROTOCOL=1:
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 everyPreAuthorize 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 toEcodSdk_PreAuthorize and EcodSdk_GetCardToken:
Transaction Response
This struct is passed to theTransactionComplete callback:
Status Codes
Device status (fromEcodSdk_GetStatus):
Amount Field Details
Amount fields use different units depending on the API method:- C API:
amount_centsinemvCorePaymentParametersand the amount argument inEcodSdk_ConfirmTransactionare 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
amountfields in theTransactionCompleteevent are returned in major units (e.g., 4.50 USD) as received from the PSP. - The
feeparameter is deprecated. Set it to0. 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_CODEattribute in the EMV Core configuration. - If
CURRENCY_CODEis missing from the configuration, thecurrencyparameter sent by the host inPreAuthorizeis 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.