I have been trying to get this Encrypted card reader to create a payment transaction in Authorize.net for a week no with no luck.
When I display the cardData.msr_RawData it does not start with 02 and end with 03. However when I view the swipe in the IDTechSDK, it does.
When I try to send the transaction to Authorize.Net I receive an E00061 error : Device information not formatted correctly.
var test = Run(AID,Common.getHexStringFromBytes(cardData.msr_rawData) , AKEY,Common.getHexStringFromBytes(cardData.msr_KSN), Convert.ToDecimal(.10), "MikeTest", cardData.msr_encTrack2, ref transCode, ref authCode, ref respCode);
public static ANetApiResponse Run(String ApiLoginID, string ecrdata, String ApiTransactionKey,string KSNstring, decimal amount, string SOPNUMBER, byte[] track2a, ref string transCode, ref string authc, ref string respcode)
{
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = AuthorizeNet.Environment.PRODUCTION;
ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = new merchantAuthenticationType()
{
name = ApiLoginID,
ItemElementName = ItemChoiceType.transactionKey,
Item = ApiTransactionKey,
};
var keyManagement = new KeyManagementScheme
{
DUKPT = new KeyManagementSchemeDUKPT
{
Operation = OperationType.DECRYPT,
Mode = new KeyManagementSchemeDUKPTMode
{ Data = "1"
//PIN = KSNstring
},
DeviceInfo = new KeyManagementSchemeDUKPTDeviceInfo
{
Description = KSNstring
},
EncryptedData = new KeyManagementSchemeDUKPTEncryptedData
{
Value = ecrdata
}
}
};
var paymentType = new paymentType
{
Item = new encryptedTrackDataType
{
FormOfPayment = new KeyBlock
{
Value = new KeyValue
{
Encoding = EncodingType.Hex,
EncryptionAlgorithm = EncryptionAlgorithmType.TDES,
Scheme = keyManagement
}
}
},
dataSource = "SWIPE"
};
var ordert = new orderType { invoiceNumber = SOPNUMBER };
// Add line Items
var lineItems = new lineItemType[1];
lineItems[0] = new lineItemType { itemId = "1", name = SOPNUMBER, quantity = 1, unitPrice = amount };
var transactionRequest = new transactionRequestType
{
transactionType = transactionTypeEnum.authCaptureTransaction.ToString(), // charge the card
amount = amount,
payment = paymentType,
order = ordert,
lineItems = lineItems,
currencyCode = "USD",
retail = new transRetailInfoType { deviceType = "1", marketType = "2" }
};
var request = new createTransactionRequest { transactionRequest = transactionRequest };
var controller = new createTransactionController(request);
controller.Execute();
var response = controller.GetApiResponse();
โ10-30-2024 10:46 AM