The EMV Core SDK provides robust APIs for managing payment transactions. These APIs enable seamless integration of cashless payment functionalities into applications, supporting open and closed-loop systems. The SDK ensures secure, efficient, and flexible payment handling while offloading complexities to the Nayax backend.

The methods available for payment management are:

The sections below describe them in more detail.

PayTransaction

Executes a single-step card transaction as opposed to 2 step transaction done with the PreAuthorize and ConfirmTransaction methods.

🚧

Pre-Authorization Approach

Nayax encourages merchants to choose the Payment with Pre-Authorization approach using PreAuthorize and ConfirmTransaction since it's safer in cases of communication problem.

See the PayTransaction API signature in the code below:

void PayTransaction(int amountMinorUnits, int currency, int productID, int timeoutSeconds, boolean continuous) throws EmvCoreException;

Parameters:

ParameterDescription
amountMinorUnitsAmount to charge in minor units (cents, not dollars).
currencyISO 4217 currency code (e.g., 840 for USD).
productIDID of the product selected by the consumer. This number will be saved in the server and available for reports.
timeoutSecondsMaximum wait time for card presentation.
continuousWhether to enable continuous polling.

EMV-Core will wait for a card to be presented to the reader, read it, process it with the payment service, and then return a TransactionComplete event. The application can cancel the last transaction by calling the VoidTransaction method before another transaction has been performed.

PreAuthorize

This method initiates a pre-authorization transaction with a specified amount. It helps reserve funds without immediate settlement, such as EV chargers reserving a maximum amount before actual usage. EMV-Core will wait for a card to be presented to the reader, read it, and process it with the payment service if needed. It will then send the TransactionComplete event.

See the PreAuthorize API signature in the code below:

void PreAuthorize(int amountMinorUnits, int currency, int productID, int timeoutSeconds, boolean continuous) throws EmvCoreException;

Parameters:

ParameterDescription
amountMinorUnitsAmount to charge in minor units (cents, not dollars).
currencyISO 4217 currency code (e.g., 840 for USD).
productIDID of the product selected by the consumer. This number will be saved in the server and available for reports.
timeoutSecondsMaximum wait time for card presentation.
continuousWhether to enable continuous polling.

📘

ProductID ≠

productID ≠ 0 is used to indicate that the amount set in PreAuthorize is final and will not change in ConfirmTransaction. If this is not the case, use productid=0 in PreAuthorize and set the real productid in ConfirmTransaction

If the transaction was approved (TransactionComplete event returned with status.OK), the application must call theConfirmTransaction or VoidTransaction methods to complete the transaction.

ConfirmTransaction

A confirmation request is the second stage of an authorization request. It is used to confirm the authorization obtained so that settlement can take place

See the ConfirmTransaction API signature in the code below:

void ConfirmTransaction(String transactionReference, int actualAmountMinorUnits, int productID) throws EmvCoreException;

Parameters:

ParameterDescription
transactionReferenceUnique reference from pre-authorization.
actualAmountMinorUnitsThe final amount for settlement.
productIDProduct identifier.

VoidTransaction

This request is used to void a transaction in 2 cases:

  • The Transaction has Pre-Authorized but not Confirmed (settled) to release funds reserved against an account when the transaction will no longer occur.
  • The transaction has been done using PayTransaction but needs to be canceled.

See the VoidTransaction API signature in the code block below:

void VoidTransaction(String transactionReference) throws EmvCoreException;

Parameters:

ParameterDescription
transactionReferenceUnique reference from pre-authorization.

CancelTransaction

The CancelTransaction method stops the execution of an ongoingPayTransaction or PreAuthorize call. The system blocks further requests until the cancellation is accepted and confirmed.

See the CancelTransaction API signature in the code below:

void CancelTransaction()

🚧

Error Return

If the card has already been presented, the system returns a CannotCancel error.