Enable TrueLayer for Magento

Set up the TrueLayer plugin and configure your settings to enable you to start accepting payments.

This guide assumes that you have already set up your TrueLayer account in Console. If you haven't, take a look at our Console configuration docs to learn how.

Before you start

This guide assumes that you already have:

You need to set these up before you start working with the plugin itself.


Start in sandbox

Before moving any real money, make sure to test payments using sandbox credentials first. Check that General > Mode is set to Sandbox.

To access your Sandbox credentials in Console, ensure that the Live toggle in the top right is set to off.

1. Install the plugin using Composer

To install the plugin:

  1. Download the latest TrueLayer Payments for Magento plugin from GitHub.
    Or enter the command below in the command line of your root:
composer require truelayer/magento2
  1. Connect to your Magento 2 store.
  2. Clean the cache.
  3. Deploy the content in your Magento environment using this command in your command line:
php bin/magento setup:upgrade
php bin/magento cache:clean

If Magento is running in production mode, deploy the static content below:

php bin/magento setup:static-content:deploy
  1. Go to your Magento admin portal. Navigate to Stores > Configuration > Sales > TrueLayer.

2. Configure your settings in Magento

  1. In TrueLayer, go to General.
  1. Enter the credentials in the table below.
CredentialExample valueWhere to find it
Merchant account ID363aglc4-1451-4089-b143-c2ad0e237322Console > Payments > Merchant Account > Details
Client ID (sandbox)sandbox-ecommerceplugins-1109e0Console > Settings
Client secret (sandbox)bf945c77-b697-433c-b4f2-36dcc7e8c886Console > Settings > Saved to your desktop as a .txt file upon generation
Private key (sandbox)ec512-private-key.pemOn your device
KID (sandbox)c7d2f140-7fdd-4272-b948-23c32a613546Console > Payments > Settings > Signing keys

  1. In the Title field, enter the text Pay by bank app.
  2. If you want to send an email to your user when they complete an order, toggle on Send Order Email.
  3. If you want to send an email to your user with invoice details, toggle on Send Invoice Email.
  4. Enable Debug Mode under Debug & Logging.
    This ensures that both you and TrueLayer receive useful information if an error occurs.
  5. Select Save Config. This saves your configuration in its current state, and enables you to check your credentials.

Optionally, click Check credentials to ensure that your client credentials are valid. This function does not check your private key and KID.

[Optional] Set UI colours

To change the colours of the payment authorisation UI, go to Stores > Configuration > Sales > TrueLayer.

Scroll down to Hosted payment page settings. In this section are the Primary Color, Secondary Color and Tertiary Color options. Click each of the coloured bars to choose a colour from the picker, or enter its corresponding hex code.

The colour picker in the TrueLayer settings menu.

The colour picker in the TrueLayer settings menu.

3. Switch to live

To switch to live, go to Stores > Configuration > Sales > TrueLayer > General and use the dropdown to switch the Mode to Live.

You will need to use different client credentials and keys for live mode.