This article talks about how to fix the issues caused by the encryption key not being moved together with DB dump to the other environment.
After importing a database dump from Production to Staging/Integration environments, saved credit card numbers appear wrong and/or payments fail for payment integrations requiring usage of merchant credentials.
The encryption key used to encrypt sensitive data, like credit card numbers and merchant credentials, is not stored in the database, and therefore does not get transferred to other environment after database dump import/export.
You need to copy the encryption key from the source environment and add it to the destination environment.
To copy the encryption key:
app/etc/env.php
in a text editor.key
for crypt
.return array ('crypt' => array ('key' => '<your encryption key>', ),);
To set the key value for the destination project:
CRYPT_KEY
will be overridden in the app/etc/env.php
file on every deployment.Optionally, you can manually override the encryption key in the app/etc/env.php
file:
app/etc/env.php
in a text editor.key
value for crypt
.env.php
.bin/magento cache:clean
or in the Commerce Admin under System > Tools > Cache Management.