If your integration uses local communications, you need to protect your integration against man-in-the-middle attacks, eavesdropping, and tampering. To help you with this, we provide GitHub libraries that:
- Validate the terminal certificate, to confirm your POS app is communicating directly with an Adyen-supplied payment terminal.
- Encrypt communications. This prevents intruders from reading the messages transmitted between the POS app and the terminal.
These GitHub libraries work with Terminal API and are completely separate from the classic libraries, which have been deprecated.
Encrypt communications
The available libraries are:
- .NET - adyen-dotnet-api-library
- Terminal API for iOS - adyen-terminal-api-ios
- Java - adyen-java-api-library
- Node - adyen-node-api-library
The libraries will:
- Serialize the request object to JSON and then encrypt and sign the request.
- Send the request and receive the response.
- Decrypt and deserialize the response and pass the content to the response object.
Select a tab below for the Adyen GitHub library you want to use.
Full code samples
Select a tab in the code sample block below to see the code for encrypting communications. In all cases you need to know the key identifier, passphrase, and version of your shared key.
To find the details of your shared key in your Customer Area:
- Under In-person payments, go to the Terminal settings for your merchant account or store.
- Select Integrations and under Terminal API go to Encryption key.
- To see the key identifier, passphrase, and version values, select Decrypted.
Troubleshooting
Crypto errors and SSL connection errors indicate a problem with the protection of the local communications.
Crypto errors
Example:
Exception: System.Net.WebException: The remote server returned an error: (401) Unauthorized.
The response body contains:
{
"errors":[
"Nexo Service: crypto error"
],
"ServiceID":"1234567890"
}
Cause: Crypto errors are related to the shared key. After you set up the shared key in your Customer Area, the shared key values in your code must match the shared key values in the Customer Area.
If you are using a library, check the values for the relevant object:
- With the .NET library, check the
EncryptionCredentialDetails
object. - With the Java library, check the
SecurityKey
object. - With the Node library, check the
SecurityKey
object.
If you are using your own code:
- Check the key derivation function. This uses the passphrase of the shared key.
- Check the security trailer function. This uses the version and the identifier of the shared key.
SSL connection error
Example:
Exception : System.Net.WebException: The SSL connection could not be established
Possible cause: Adyen's root certificate is not installed correctly.