Tokenization with TSYS in the 4D Payments SDK


This KB entry demonstrates tokenization of Credit Card data with the TSYS payment processors.

In order to perform tokenization with the TSYS payment processor, it is necessary to use the GenKey and Token Configuration settings, along with the RetreiveToken and RequestToken action Configuration settings.

TSYSRetail1.Merchant.BankId = "999995"; TSYSRetail1.Merchant.CategoryCode = "5999"; TSYSRetail1.Merchant.Name = "TESTMERCHANT"; TSYSRetail1.Merchant.Number = "888000002447"; TSYSRetail1.Merchant.City = "800-1234567"; TSYSRetail1.Merchant.State = "NC"; TSYSRetail1.Merchant.StoreNumber = "1515"; TSYSRetail1.Merchant.TerminalNumber = "0003"; TSYSRetail1.Merchant.Zip = "27707"; TSYSRetail1.Merchant.ServicePhone = "9195447070"; TSYSRetail1.IndustryType = DPayments.DPaymentsSDK.TsysretailIndustryTypes.sitRetail; TSYSSettle1.Merchant.BankId = TSYSRetail1.Merchant.BankId; TSYSSettle1.Merchant.CategoryCode = TSYSRetail1.Merchant.CategoryCode; TSYSSettle1.Merchant.Name = TSYSRetail1.Merchant.Name; TSYSSettle1.Merchant.Number = TSYSRetail1.Merchant.Number; TSYSSettle1.Merchant.City = TSYSRetail1.Merchant.City; TSYSSettle1.Merchant.State = TSYSRetail1.Merchant.State; TSYSSettle1.Merchant.StoreNumber = TSYSRetail1.Merchant.StoreNumber; TSYSSettle1.Merchant.TerminalNumber = TSYSRetail1.Merchant.TerminalNumber; TSYSSettle1.Merchant.Zip = TSYSRetail1.Merchant.Zip; TSYSSettle1.TerminalId = "71129306"; TSYSRetail1.TransactionNumber = 123; //genKey is a string containing the GenKey created by activating a POS terminal TSYSRetail1.Config("RequestToken=True"); TSYSRetail1.Config("GenKey=" + genKey); //Retrieves a token without any other kind of transaction TSYSRetail1.TransactionAmount = "0"; TSYSRetail1.TransactionNumber = TSYSRetail1.TransactionNumber + 1; TSYSRetail1.Card.EntryDataSource = EntryDataSources.edsManualEntryTrack1Capable; TSYSRetail1.Card.Number = "4444333322221111"; TSYSRetail1.Card.ExpMonth = 12; TSYSRetail1.Card.ExpYear = 2015; TSYSRetail1.Config("RetrieveToken"); string token = TSYSRetail1.Config("Token"); TSYSRetail1.CardPresent = false; TSYSRetail1.Config("Token=" + token); TSYSRetail1.Card.EntryDataSource = EntryDataSources.edsManualEntryTrack1Capable; TSYSRetail1.Card.ExpMonth = 12; TSYSRetail1.Card.ExpYear = 15; TSYSRetail1.Config("RequestToken=False"); TSYSRetail1.Config("GenKey=" + genKey); TSYSRetail1.TransactionAmount = "100"; TSYSRetail1.Authorize(); TSYSSettle1.DetailRecords.Add(new TSYSRecordType(TSYSRetail1.GetDetailAggregate())); //creates a detail record of the transaction to be settled DetailRecord1.VoidTransaction = false; DetailRecord1.TransactionType = TsysdetailrecordTransactionTypes.dttOffLineCredit; DetailRecord1.ResponseApprovalCode = ""; DetailRecord1.EntryDataSource = TsysdetailrecordEntryDataSources.edsManualEntryTrack1Capable; DetailRecord1.Config("Token=" + token); DetailRecord1.AuthorizedAmount = "0"; DetailRecord1.CardNumber = ""; DetailRecord1.SettlementAmount = "100"; DetailRecord1.TransactionDate = DateTime.Now.ToString("MMdd"); DetailRecord1.TransactionTime = DateTime.Now.ToString("hhmmss"); DetailRecord1.TransactionNumber = DetailRecord1.TransactionNumber + 1; DetailRecord1.CardholderId = "@"; DetailRecord1.TransactionId = DetailRecord1.TransactionNumber.ToString(); TSYSSettle1.DetailRecords.Add(new TSYSRecordType(DetailRecord1.GetDetailAggregate())); // Settle Transactions TSYSSettle1.Config("GenKey=" + genKey); TSYSSettle1.SendSettlement();

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