This function allow merchants to use a double layer encryption :
The whole traffic is encrypted through the SSL tunnel ;
The card object is encrypted inside the message.
Please contact our sales team to access this feature.
Encryption step
The processing takes place in 3 steps:
The merchant requests parameters to generate the encryption key.
The merchant encrypts the sensitive data on his server.
The merchant calls the Payline web services with the encrypted data.
How to integrate
To start this step, you must have a merchant and a merchant access key.
You must integrate Payline web services and know RSA data encryption :
getEncryptionKey : allows you to retrieve the encryption settings to encrypt your message.
Step 1 : Call the getEncryptionKey to obtain the key.
Merchant calls the getEncryptionKey service on the usual endpoint.
This service can be called multiple times if needed (for instance multiple place to store the public key). The parameters are the version and merchantKeyName. It must be set to 32.
You must integrate the Payline web services:
The merchant performs a getEncryptionKey : retrieves the encryption parameters.
The merchant retrieves the encryption parameters and the key.keyId from getEncryptionKey.
These data must be stored by the merchant in order to encrypt further messages.
If the merchantKeyName don't respect the format, you will receive the following error : 02204 - ERROR
Process for the call response with multiple keys (version 32)
If keypair named with the "merchantKeyName" filled in, does not exist /OR/ keypair named with the "merchantKeyName" filled in exists and dateKeyPair > 60 :
Generate new key pair named "merchantKeyName" and return a new public key
If keypair named with the "merchantKeyName" filled in exists and dateKeyPair < 60 :
Return current public key
This service returns the key details:
RSA public key details (alogorithm, size, exponent, ...);
Key expiration date;
Key ID.
merchantKeyName;
These data must be stored by the merchant in order to encrypt further messages.
Step 2 : Encrypt the card data with the public key
Having data from step 1, merchant can instantiate a key using details provided by the getEncryptionKey service. The merchant can then encrypt the message with the sensitive data.
The encryption function must :
generate a public key with the parameters retrieved from the getEncryptionKeyReply : algo, modulus, exponent ;
build the public key with the parameters: modulus and publicExponent ;
Then merchant can encrypt the cardDataToEncrypt using the publicKey. Before sending this data in any payment or authentication service, it has to be converted in base 64.
The Get Encryption Keyservice of theSecurity REST APIprovides the merchant with the public key to encrypt a message.
This service is based on the JWE/JWK standard.
It works in every way like the existing service, except that thename() parameter is required for the REST API.merchantKeyName
Step 3 : Calls the Payline web services with the encrypted data.
Merchant can send encryptedData in web services message instead of clear data. One very important element is the key ID : Monext will uncrypt data with the private key associated to this key ID. Check the getEncryptionKey service to list the services using the encrypted message.
Here is an exemple of the card object in messages with the encryptedData.
The following keys are accepted in the encrypted data:
CardNumber
card.number
497010000000006
ExpDate
card.expirationDate
0220
CVX
card.cvx
123
OwnerBirthDate
card.ownerBirthdayDate
31121980
Password
card.password
Payline01$
Cardholder
card.cardholder
Jeremy Mattio
Key renewal
A key is valid for 90 days. A new key will be issued 30 days before the previous key expiration. During this period both keys are valid and usable. A merchant has 30 days to change the key in its systems before the old key become unusable. A good practice is to call the getEncryptionKey everyday, and to start the renew process as soon as a new key ID is received by the merchant
In order to prevent misuse and not to saturate the database, the system refuses a generation of a new key, if there are more than 100 active keys simultaneously. So, at each key draw, the system looks for the number of active key pairs (whose life date is <= 90 days) by taking the unique name of the key (disctinct merchantKeyName) .
If a merchant has more than 100 active keys at the same time, the system rejects a new key issue with code 02203 - ERROR.
Security
The key is unique per merchant.
The current key specification are :
Algorithm : RSA
Key size : 2048
Cipher : RSA/ECB/OAEPWithSHA-256AndMGF1Padding
Code example
Encryption function code example used by merchant to encrypt the message.