# JPMC-PDP Documentation from https://developer.payments.jpmorgan.com # Encryption Page encryption is an effective method of reducing Payment Card Industry (PCI) scope by protecting sensitive information, which can then safely pass through your application and in payment authorization requests. For security reasons, do not store encrypted data. Only use encrypted data to process transactions in real time. Authorization responses containing transaction reference IDs or tokens may be stored on your application for future transactions or servicing. ## How page encryption works To secure cardholder payment data entered by a registered or guest shopper, page encryption secures the sensitive data within the browser session. The HTML code of your payment page must include the following JavaScript (JS) files: - getkey.js — Retrieves a one-time dynamic key that is used for encryption. - Test environment URL: https://safetechpageencryptionvar.chasepaymentech.com/pie/v1/YYYYYYYYYYYY/getkey.js - Production environment URL: https://safetechpageencryption.chasepaymentech.com/pie/v1/YYYYYYYYYYYY/getkey.js - encryption.js — Uses the key to encrypt card information as it is entered. - Test environment URL: https://safetechpageencryptionvar.chasepaymentech.com/pie/v1/encryption.js - Production environment URL: https://safetechpageencryption.chasepaymentech.com/pie/v1/encryption.js You must replace `YYYYYYYYYYYY` with the ID you recieve from your J.P. Morgan implementation manager. > The test and production URLs are similar. Confirm the correct URL is in place, especially when testing or switching environments. > ## Implement page encryption Complete the following steps to implement the page encryption service: **Step 1**: Add **getkey.js** to the HTML code of the payment page. Your ID is provided by an implementation manager after page encryption is enabled for your account. This value must be used in the encryption/decryption request. **Step 2**: Add **encryption.js** to the HTML code of the payment page. This action encrypts the account number and card verification value (CVV). The embedded JS provides the following two features: - ValidatePANChecksum — Performs a MOD 10 checksum on the account number entered. Major card types include a checksum as the last digit to ensure correct entry of the account number. The function returns true if the checksum is valid. It is good practice to validate the checksum to avoid unnecessary API calls. - ProtectPANandCVV — Performs the encryption on the specified account number value and card security value. Submit three parameters: credit card, CVV (optional), and embed flag. Note: Set the boolean parameter embed to false. This routine returns an array of three values. NULL is returned if an error occurs during encryption. ```javascript var result = ProtectPANandCVV(ccno, cvv, false); if(result != null) { document.getElementById("cryptCard").value = result[0]; document.getElementById("cryptCvv").value = result[1]; if (result.length > 2) { document.getElementById("integrityCheckVal").value = result[2]; } else { alert("Error: ProtectPANandCVV call returned null. You may have entered an invalid card number."); } } ``` The following sample HTML contains **getkey.js** and **encryption.js**: ```