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:- Nayax sends a random challenge string to your StartSession endpoint
- You generate a Transaction ID, encrypt it together with the challenge, and return the cipher
- Nayax decrypts the cipher to extract and verify the Transaction ID
- 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 Derived AES-256 key (last 32 characters):
TokenId from the request. These 32 characters form the 256-bit AES key.Full Secret Token: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
RandomNumberin the decrypted plaintext matches what was sent in the request - The overall format is as expected (64 characters, correct separator)
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 correctTranIDCipher 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}
Next steps
Register
Send your first fiscal registration request after authenticating.
Void
Un-register a transaction when a product is not dispensed.