4D Payments SDK 2016 .NET Edition

Questions / Feedback?

RequestCurrentKeys Method

Used to retrieve the current encryption keys from Paymentech.


public void RequestCurrentKeys();
Public Sub RequestCurrentKeys()


This method retrieves the current encryption keys from Paymentech, and stores them in the PINKey and MACKey properties. These keys are used by the PIN pad device to encrypt customer PINs and to create and validate MAC hash values, and are normally updated after every Authorize transaction. But when the PIN pad is first initialized (or when the PIN pad becomes out of sync with the Paymentech Server) you must retrieve the current keys using this method.

Keys are required to be renewed every:

  • 200 Transactions
  • 24 Hours
  • Each time a Batch is released for settlement
  • Whenever the PIN pad loses sync with the server
When the host changes the key, a new key index is assigned and returned in the EncryptedKeyIndex property. The component needs to update the PIN pad with the PINKey and MACKey after each transaction in order to stay in sync with the host. If the keys and/or the EncryptedKeyIndex become out of sync, you must use the RequestCurrentKeys method to retrieve a valid set of keys and restore the synchronization.

If the ForceKeyRequest field is True after any transaction, you must immediately perform a RequestCurrentKeys transaction before sending any more authorizations.

For example:

  component.MerchantNumber = "yourMerchantNumber"  
  component.TerminalNumber = "100"
  component.ClientNumber = "0002"
  component.UserId = "yourUserId"
  component.Password = "yourPassword"
  component.SequenceNumber = 1
  component.PinPadSerialNumber = "FFFFFFFFFFFFFFFF" ' retrieved from your PIN Pad
Now load the PINKey and MACKey into the PIN Pad device.

Copyright (c) 2021 4D Payments Inc. - All rights reserved.
4D Payments SDK 2016 .NET Edition - Version 16.0 [Build 8017]