TSYS Interleaved Authorization Mode

Speed up TSYS Authorization requests by sending interleaved transactions.

Date Entered: 06/28/2016    Last Updated: 09/06/2016

Requirements: Direct Payment Integrator

TSYS supports both half- and full-duplex communication modes for authorization requests. Half-Duplex is also referred to as "Single-Transaction" mode. In this mode, establishment of a new connection is required for each individual transaction request being processed. This communication mode is intended for use in low to medium transaction volume environments.

Full-Duplex or also referred to as "Interleaved Mode", is intended for high volume transaction environments. When using this communication mode, transaction data is transmitted and received simultaneously without blocking. The advantage of an Interleaved Session is that the connection can stay up and is stateless once connected. Up to 10 requests can be sent using the same connection.

The following configuration settings apply to Interleaved Mode. Please see below or refer to the help file for more details:

  • InterleavedMode
  • InterleavedTimeout
  • MaxPendingResponseCount
  • DoEvents
  • DisconnectInterleaved

To enable Interleaved mode set the InterleavedMode configuration setting to True. For instance:

Tsysecommerce TSYSECommerce1 = new Tsysecommerce(); //Interleaved Transaction Mode TSYSECommerce1.Config("InterleavedMode=True");

When InterleavedMode is set to True, and the Authorize method is called, the component will return immediately without waiting for a response to come back from TSYS. The Response event will fire for each response.

There is no guarantee that transaction data will be received in the order it was transmitted. The TransactionId parameter in the Response event can be used to identify the transaction. This parameter will contain the same TransactionId sent in the authorization request, which was set via the TransactionNumber property. ResponseCode and ResponseText parameters can be used to determine if a transaction was approved or declined. For instance:

TSYSECommerce1.OnResponse += (sender, args) => { Console.WriteLine("Response received for: " + args.TransactionId + "," + args.ResponseCode + "," + args.ResponseText + "," + args.ResponseApprovalCode); string detailAggregate = TSYSECommerce1.GetDetailAggregate(); };

If the authorization was successful and an approved ResponseCode was returned, GetDetailAggregate method should be called inside the event in order to get the Detail Aggregate which can later be used to Settle the transaction.

It is up to the POS System to keep track of which request was approved and which declined. In case the Response event fires with a declined ResponseCode, that particular transaction will need to be resent for authorization.

The MaxPendingResponseCount configuration setting can be used to control how many response packets are pending. By default the value for this configuration setting is 10 which is equal to the maximum number of interleaved transactions that can be sent using the same connection. If an authorization is attempted that would exceed the maximum number of pending response an error occurs.

The DoEvents configuration setting is an action config that can be used to process any available events. This should be called when there are outstanding response packets that have not yet arrived.

The InterleavedTimeout configuration setting can be used to control the time the component should be waiting for a response to come back from TSYS. By default the value for this configuration setting is 60 seconds. If no response is received within InterleavedTimeout seconds the Error event will fire and the connection will be closed.

After all response packets are received, the connection can be explicitly terminated by calling the DisconnectInterleaved configuration setting. For instance:

//Explicitly Disconnect TSYSECommerce1.Config("DisconnectInterleaved");

Please refer to the sample code below for a more complete sample code. The "for loop" is mimicking an environment where multiple authorization request are sent at the same time without blocking.

Authorization Example

//Interleaved Transaction Mode TSYSECommerce1.Config("InterleavedMode=True"); //Maximum number of pending response packets. TSYSECommerce1.Config("MaxPendingResponseCount=10"); //Credit Card information TSYSECommerce1.Card.EntryDataSource = EntryDataSources.edsManualEntryNoCardReader; TSYSECommerce1.Card.Number = "4444333322221111"; TSYSECommerce1.Card.CVVData = "999"; TSYSECommerce1.Card.ExpMonth = 1; TSYSECommerce1.Card.ExpYear = 2020; int totalRequests = 10; int currentResponseCount = 0; TSYSECommerce1.OnResponse += (sender, args) => { Log("Response received for csharp, {1}, {2}, {3}", args.TransactionId, args.ResponseCode, args.ResponseText, args.ResponseApprovalCode); string detailAggregate = TSYSECommerce1.GetDetailAggregate(); //Increase the count of responses received currentResponseCount++; }; for (int i = 0; i < totalRequests; ++i) { TSYSECommerce1.TransactionNumber = i + 1; //Authorize TSYSECommerce1.Authorize(); } while (currentResponseCount < totalRequest) { //Call DoEvents until all response packets are received TSYSECommerce1.Config("DoEvents"); } //Explicitly Disconnect TSYSECommerce1.Config("DisconnectInterleaved");


We appreciate your feedback.  If you have any questions, comments, or suggestions about this entry please contact our support team at kb@nsoftware.com.

 
 
Downloads