Skip to main content
Before any fiscal transaction, Nayax initiates a StartSession exchange with your server to establish a trusted session. The process uses a pre-shared Secret Token and AES-256-ECB encryption to bind a unique Transaction ID to each session.

How it works

Nayax and each integrator share a unique Secret Token: a 66-character string provided by Nayax at kickoff. The last 32 characters of this token serve as the AES-256 encryption key. The exchange works as a challenge-response:
  1. Nayax sends a random challenge string to your StartSession endpoint
  2. You generate a Transaction ID, encrypt it together with the challenge, and return the cipher
  3. Nayax decrypts the cipher to extract and verify the Transaction ID
  4. That Transaction ID is used in all subsequent Register and Void calls in the session
Validate Transaction IDs on your end. When Nayax sends a Register or Void request, verify that the BasicInfo.TransactionId was issued by your server in a prior StartSession call and has not expired. Transaction IDs should remain valid for no longer than 10 minutes.

Step-by-step process

The following uses example values at each stage to illustrate the full flow.
1

Nayax sends the StartSession request

Nayax sends a POST to your /FisCortina/StartSession endpoint. The request body contains the TokenId reference number and a 27-character random string (RandomNumber).Example RandomNumber (27 characters):
2

Generate a Transaction ID

Generate a Transaction ID consisting of exactly 36 numeric characters. This ID must be unique per session and stored for later validation.Example Transaction ID (36 numeric characters):
3

Build the plaintext

Create a 64-character plaintext by concatenating the Transaction ID, a literal = separator, and the RandomNumber from Step 1.Format: {TransactionId}={RandomNumber}Example (64 characters):
4

Derive the AES encryption key

Extract the last 32 characters of the Secret Token matching the TokenId from the request. These 32 characters form the 256-bit AES key.Full Secret Token:
Derived AES-256 key (last 32 characters):
5

Encrypt and return TranIDCipher

Encrypt the 64-character plaintext using AES in ECB mode with PKCS5 padding. Base64-encode the result and return it as TranIDCipher in your StartSession response.Resulting TranIDCipher:
6

Nayax decrypts and validates

Nayax decrypts the TranIDCipher using the same AES key and validates that:
  • The RandomNumber in the decrypted plaintext matches what was sent in the request
  • The overall format is as expected (64 characters, correct separator)
If validation fails, Nayax rejects the session.
7

Transaction ID used in subsequent calls

Nayax uses the decrypted Transaction ID in all subsequent Register and Void requests for the session. It appears in the BasicInfo.TransactionId field. Your server must validate this ID against your own records on every incoming request.

Code example

Use this Python snippet to verify your StartSession implementation produces the correct TranIDCipher before testing with Nayax.

Verifying your encryption

Use the devglan.com AES decryption tool to confirm your output is correct before testing with Nayax:
  • Mode: ECB
  • Key size: 256-bit
  • Key: last 32 characters of your Secret Token
  • Input: {TransactionId}={RandomNumber}
Decrypt the output and confirm it matches the plaintext you built in Step 3.

Next steps

Register

Send your first fiscal registration request after authenticating.

Void

Un-register a transaction when a product is not dispensed.