API Connection

Opening and Closing a Connection

To connect to BackOffice, use the following syntax. Failure to close or abort connection will result in time-outs and a temporary inability to reconnect. This example also demonstrates the proper technique to use while opening a new connection. Using try/catch ensures the connection will be closed in the event an error is raised.

//Open Connection
BackOffice.ConnectionClient conn = new BackOffice.ConnectionClient();

try
{
 	 //TODO: REQUESTS TO CONNECTION GO HERE

 	 // Close connection
 	 if (conn.State != System.ServiceModel.CommunicationState.Faulted) 
		conn.Close();
}
catch (Exception ex)
{
 	 conn.Abort();
}
					

Authenicate Token

Each request passsed to the BackOffice API must include an authentication token. The token consists of a TerminalID and TerminalKey.

// Create authentication token
BackOffice.AuthenticationToken token = new BackOffice.AuthenticationToken();
token.TerminalID = "00000000-0000-0000-0000-000000000000"; 	  
token.TerminalKey = "1234567"; 								  

req.Token = token;
					

Testing Connection

If you wish to test the connection to BackOffice (not test transactions), Connection can be easily tested using the method below. To accomodate testing operations of the service (such as a test Credit Charge), each BackOffice request includes a "TestMode" flag.


BackOffice.Execution exe = conn.TestConnection(token);
if (exe.IsSuccess)
{
 	  // Successfully Authenticated
}
else
{
 	  ShowError(exe.Message);
}