Samples in C#The following code snippets are provided in C# for example purposes. Developers should implement the same logic (e.g., AES-256 ECB encryption, SHA-256 hashing) in their chosen programming language to successfully communicate with the Spark DMZ.
Step 1: Generating the Cipher
The Cipher field is a securely encrypted payload that must be included in the request body. It serves as a strong mechanism to prove that you possess the necessary secret token without transmitting it openly. This function creates the final, encrypted Cipher string to be included in the request body.C#
sparkTransactionId: Transaction identifier (use “1234” for testing)tokenSecretString: Your secret token (key) which is used as the AES-256 ECB encryption key.random: 17-digit random number.timestamp: UTC time in formatyyMMddHHmm(optional)
Step 2: Create Signature
The signature authenticates each request by combining the serialized request body with your header hash key and computing a SHA-256 hash. This signature is sent in the HTTP headers, along with your integrator ID, to verify the request’s origin and integrity. This function calculates the signature string and packages it into the required HTTP headers.C#
request: The whole request body object (StartAuthenticationRequest3rdParty in this case)integratorId: Your unique integrator ID.IntegratorValue: A secretHeaderHashKeyused to authenticate the integrator.
IntegratorId and Signature.
Request Model
The request model defines the structure of data sent to initiate authentication with Spark. Each authentication request must include your token ID, terminal identification details, and the encrypted cipher (created using theCreateCipher() method), and the random 17-digit number used in cipher generation.
C#
Response Model
The response model defines the structure of data returned after initiating authentication with Spark. It includes the hashed transaction ID and status information.C#