MACValue Property
Hash of transaction data used to verify message was not tampered with.
Syntax
ptechcanadiandebit.getMACValue([callback]) ptechcanadiandebit.setMACValue( MACValue, [callback])
Default Value
""
Callback
The 'callback' parameter specifies a function which will be called when the operation completes (or an error is encountered). If the 'callback' parameter is not specified, then the method will block and will not return until the operation completes (or an error is encountered).
The callback for the getMACValue([callback]) method is defined as:
function(err, data){ }
'err' is the error that occurred. If there was no error, then 'err' is 'null'.
'data' is the value returned by the method.
The callback for the setMACValue([callback]) method is defined as:
function(err){ }
'err' is the error that occurred. If there was no error, then 'err' is 'null'.
'err' has 2 properties which hold detailed information:
err.code err.message
Remarks
Each transaction you send (excluding RequestCurrentKeys and MACReversals) requires an accompanying MACValue. This value is a hash of the contents of GetRequestDataToMAC, and is hashed by the PIN Pad device using the ResponseMACKey returned in response to the last transaction.
The GetRequestDataToMAC method returns a string containing the values of several transaction properties. This string must be MAC'ed by the PIN pad, so it is essential that the following properties be set before calling GetRequestDataToMAC:
- MerchantNumber
- TerminalNumber
- InteracTransactionType
- CardTrack2Data
- TransactionAmount
- SequenceNumber
- and optionally AccountType
Note that VeriFone pinpads support a PURCHASE transaction where the CardTrack2Data, EncryptedPIN, AccountType, and MACValue are returned in a single step. When using a VeriFone pad make sure AccountType is set to acctNotSet, otherwise the MACValue will not be calculated correctly. (AccountType must be set before calling GetRequestDataToMAC for Ingenico pads)
class.MerchantNumber = "yourMerchantNumber" class.TerminalNumber = "100" class.ClientNumber = "0002" class.UserId = "yourUserId" class.Password = "yourPassword" class.SequenceNumber = 2 class.TransactionAmount = "1.00" class.PinPadSerialNumber = "30700015P3600000" ' from label on back of PIN pad class.InteracTransactionType = ittSale class.AccountType = acctChecking class.CardTrack2Data = "9999999800002773=05121015432112345678" ' from card reader class.EncryptedPIN = "FFFFFFFFFFFFFFFF" ' from the PIN pad ' Now use the PIN pad to MAC the value returned from GetRequestDataToMAC ' and then set MACValue with the results class.MACValue = "FFFFFFFF" class.Authorize()
Data Type
String