Skip to main content
All CollectionsApps, Tools & Integrations
How to Set up the GoCardless Integration
How to Set up the GoCardless Integration

How to set up and install the GoCardless payment integration for Administrators

Alex Hales avatar
Written by Alex Hales
Updated over a week ago

This article will guide you through all the steps and actions required to set up the GoCardless Integration on The Layer.

For information on understanding and using this feature, please refer to Using the GoCardless Integration.

The GoCardless payment integration is a premium feature; if you're interested in using this feature, please contact your Account Manager.

⚠️Permission Required: The Role CRM Administrator is required to set up and manage this feature.


Tip: Before you start, consider creating a "notepad" file to store the data you'll be collating throughout this process, so it's in one place and available when you need it!

Step 1 - Consider your Redirect Page

When your customers have set up their Direct Debit on GoCardless, they'll be redirected back to a confirmation page.

This could be as simple as your Company logo, alongside a "Thank you for submitting your direct debit form. Your details have been successfully recorded" message.

There are 4 options for this page:

Option 1 - You can create this yourself very simply, later in the configuration at Step 6.

Option 2 - You can arrange to have a landing page designed and hosted externally.

Option 3 - Use a public link to an HTML file held in File Manager on The Layer, which you arrange to be designed and created externally.

Option 4 - Use a public link to an HTML file held in File Manager on The Layer, which we create for you. If you would like our developers to create or customise a page for you, please speak to your Account Manager about this chargeable service.


​Consider how you wish to proceed before you begin the rest of the process, so that design and/or development time may be factored into your setup timescales.

Once you have your landing page confirmed, whether using a Layer-hosted file, or an externally hosted page, note the URL. This be your Redirect URL later, in Step 4, unless you choose Option 1.


Step 2 - Setting up The Layer as a connecting app on GoCardless

First, we need to set up GoCardless to connect to The Layer. To do this, you'll need to create an App on your GoCardless account.

Creating the App


Go to your GoCardless account and log in.

Navigate to Developers - Developers - Partners - Create App

Populate the following fields:

App name- Give the App a name, e.g. "Layer Integration"

Description- Enter a description, this can be anything you like.

Homepage URL- Enter https://www.app.thelayer.com/


Post-onboarding URL- not required.


Webhook URL- Enter https://webapi.thelayer.com/api/Public/RecieveGCEvent (Note the spelling error here on "recieve"- this is not an error, enter as shown!)

Leave the Webhook client certificate box unticked.


Click to agree to the terms, then click Create App.

Gather App Data

Once you've created the App, the configuration screen for your new app will open.

Click Edit and navigate down to Webhook secret. Copy this and save it for later.

Under OAuth configuration, Copy the Client ID and click to Reveal the Client secret key; copy this too.

Later on in Step 5, you'll paste the Webhook secret, Client ID and Client Secret into the GoCardless Settings area on The Layer. Store this info safely for now!


Step 3 - Set up Mail Templates and Notifications

Next, we'll need to prepare the email templates and notification addresses that will be used to communicate updates, internally and to your customers.

We'll need two new email templates:

  • One for the email to be sent when sending direct debit links to your customers

  • One for GoCardless update notifications, to be received by Layer users, not your customers.

Tip: You can create the basic templates only at this stage, with holding information only, then come back to them later to add styling and details; at this stage, all we require is the email template ID. If you choose to do this, don't forget to finish creating your templates before you finish setting up the integration, or your customer may receive unfinished emails!

Navigate to Settings - Email Templates - New Email Template

Title- e.g. "GoCardless Direct Debit Email Template"
Subject- e.g. "Your Direct Debit Link from [your company name]"
Body- include the {{directdebit_link}} snippet wherever the link is required.

Once you've created your email template, copy the numeric reference from the email template URL. This will be your Mail Template ID later, in Step 4.

Tip: You can add styling, logos and imagery to your email templates, see this article for further information.

Repeat the process above to create your internal notification template:

Title- e.g. "GoCardless Event Notification Template"
Subject- e.g. "GoCardless Notification Received"
Body- Include the following:

Record Type

{{record_type}}

Reference

{{record_reference}}

Customer Name

{{customer_name}}

Details

{{details}}

Tip: To insert this into your email template in a table format, expand the section below!

Formatting your notification template with a table

To use a table format in your notification template, click the html button in your email window.

This will open the View HTML window. Paste in this code to input a basic table format containing the snippets required above, then click Update. You'll be returned to the email template screen, click Save Changes.

style="display:block;margin-left:auto;margin-right:auto;" /></a></span></p>
<table border="1" cellpadding="2" style="width:100%;"><tbody><tr><td style="width:25%;">Record Type</td>
<td style="width:75%;">{{record_type}}</td>
</tr>
<tr><td style="width:25%;">Reference</td>
<td style="width:75%;">{{record_reference}}</td>
</tr>
<tr><td style="width:25%;">Customer Name</td>
<td style="width:75%;">{{customer_name}}</td>
</tr>
<tr><td style="width:25%;">Details</td>
<td style="width:75%;">{{details}}</td>
</tr>
</tbody></table>
<p></p>


The styling of this table can be adjusted if required, please contact us if you require support with any element of HTML.

Once you've created this template, copy the numeric reference from the email template URL. This will be your Notification Template ID later, in Step 4.

Next, decide which of your Mail Agents on The Layer will be used to send these two emails. This may be one of your "support" or "accounts" type addresses.

Navigate to Settings - Mail Agents - click on your chosen Mail Agent.

From the URL, note the numeric reference. This will be your Mail Agent ID later, in Step 4.

​Once you've got the data outlined above ready, follow the steps below to install the required scripts.


Step 4 - Install the GoCardless Scripts

Next, we'll install the suite of scripts that power the GoCardless integration, using some of the information you gathered earlier.


Access the ScriptStore

In Settings, navigate to Functions - Script Store

​Then, click on GoCardless - Next. This opens the Script Parameters screen.

Input Parameters

Mail Template ID- email template ID for sending the Direct Debit link to customers, as gathered in Step 3.


Notification Template ID- email template for notifications to your Layer users when updates are available from GC., e.g. when a DD is signed, as gathered in Step 3.

Email ID- enter the email addresses of any Layer users that you want the internal notifications to be sent to. Comma separate these if you wish these to be sent to multiple people in your team.


Mail Agent ID- the ID of the mail agent you want the notifications to be sent from, as gathered in Step 3.

Base API URL- Enter https://api.gocardless.com/

Redirect URL- add a link to a landing page which will be visible to your customers when they've set up their direct debit, if using this option as explained in Step 1. If you're using the Payment Complete Block option to configure this, leave this field blank. You'll find instructions for this later on, in Step 6.

Is Sage Account Number Mandatory- you'll have the option to specify whether you would like to use Sage Account Numbers when installing this feature. If you are also using The Layer's Sage Integration and would like Sage Account Numbers to sync to GoCardless where used for your customers, enter "Yes" here; otherwise, enter "No".

For more information on the Sage Integration or advice if you're unsure what to enter here, please contact your Account Manager.

Install the Scripts

Once you've inputted the data required above into each field, click Install.


You should see the popup message "Functions installed successfully".

Close the popup window and the All Functions screen will be visible; you'll see a new Functions Group displayed in your tabs called GoCardless and each of the scripts will be visible in the window.





You'll now be able to see the GoCardless menu against your Customer records on The Layer; this won't be live until we link your GoCardless account The Layer in the following steps.


Step 5 - Add GoCardless API Details to The Layer

Next, we need to add the GoCardless API configuration details that we gathered in Step 2, to The Layer.

Navigate to Settings - Integrations - GoCardless.


Client ID- Input this at gathered from your GoCardless App in Step 2.


Client Secret- Input this at gathered from your GoCardless App in Step 2.

Scope- Input read_write

Base URL- Input https://connect.gocardless.com/

Function- Select GC: Notify Events from the drop-down.

Webhook Secret: Input this from your GoCardless App in Step 2.

The Access Token field will appear and auto-populate in the next step.



Step 6 - Connect your GoCardless Account to The Layer

Connection and Initial Authentication

Once all of the details above have been entered, click Save then Login.


This will open the GoCardless login screen. Enter your details and login and click Connect Account.

Once the accounts are connected, you will be redirected back to The Layer's API configuration screen; now, you'll see that a field for Access Token has been added and auto-populated to this page, in addition to the details entered previously.

This access token is not required elsewhere, so you do not need to use the Copy button here.

Add your Payment Complete Block

If you choose to configure your own Payment Complete page (Option 1 from Step 1) you can add this now. This section allows you to configure the web page shown to users after making a payment, if you haven't set up a redirect URL for this as explained previously in Step 1 and added in Step 4.

This is an HTML editor, similar to that used when creating an email template.

Here are some of the editing tools you can use:

  • Font formatting and size

  • Unordered lists

  • Images in body

  • Hyperlinks

  • HTML editor

  • Insert HTML

Make sure to save your changes.

You can use the test page option to preview your payment complete screen and how it will appear to your customers. This can be amended at any time.

Test and Update the Connection URL

We would recommend you test the connection to GoCardless by creating a test customer on both GoCardless and the Layer, then following the instructions to sync and create a mandate as outlined in this article.

Once synced, your test customer should appear with a green tick on their GoCardless menu:

Once you've confirmed your connection to GoCardless is live, you can update the connection from the authentication URL, to the permanent connection URL.

To do this, follow the instructions to access the GoCardless settings in Step 5, then update the Base URL to https://manage.gocardless.com/


You will now be able to begin syncing live customer records with GoCardless as outlined in the linked KBA.


Other optional steps


There are other optional setup steps you may wish to action.

  • Add a Direct Debit snippet to your quotation templates

  • Manage access and visibility of GoCardless actions for your users

  • Updating your script parameters if changes are required in future


Adding the GoCardless Direct Debit Link to Quotations

You can add a snippet into your quote template so that your customers can set up their Direct Debit when they're signing their quote.

$$gocardless_dd_link$$ can be added into your quotation sign page, on any quote templates you wish.

We would recommend that changes are not made to live quote templates. Additional code may be required if you wish to amend the styling or how this link displays to customers.

If you wish to add this snippet to your quote, please contact your Account Manager who will be able to discuss your requirements and advise if additional development support may be required.


Managing User Access to GoCardless Actions

⚠️Caution: All users will have access to manage all aspects of the GoCardless Integration at customer level, including extending Direct Debit link expiries, voiding mandates and viewing all mandates.

If you wish to limit this access, follow the steps outlined in this section.

Navigate to Settings - Functions - Manage Actions

The Company tab reflects visibility of all global actions in the Operations area.

To set user or team exclusions, click the Edit pencil icon and tick the teams or users you wish to exclude this view from.

Tip: it may be useful to create teams specifically for the purpose of managing visibility to any area detailed in this section, to make ongoing access management easier if your team changes!

Navigate to Settings - Essentials - Teams - Create Team

Give your team a name, add the required users, then click Save. Your team will then be visible in the Exclusions menu detailed above, so you can exclude in bulk.

You can follow the same process above to limit visibility at Customer level; this dictates which menu items are visible in the GoCardless menu against each Customer record.


Finally, navigate to the Others tab to set exclusions for specific actions such as Extending Expiry, Cancel Billing Request, Direct Debit links, etc; visible from the View all Billing Requests option in the customer menu


Updating Script Parameters

You may need to make changes to your script parameters if required in the future.

Examples may include:

  • Creating new email templates

  • Changing personnel who should should receive internal notifications

  • Changing the internal mail agent who sends the notifications

  • Changing your Payment Complete page source as outlined in Step 1

  • Amending the requirement for Sage account numbers to be used


To do this, navigate to the ScriptStore and click on the GoCardless tile, then click on Update Parameters:

Here, you'll be able to update any of the settings that were configured in Step 4.

Simply make your changes and click Update.

You can also review your existing parameters at any time, without making changes, by clicking View.

If you decide to stop using the GoCardless integration in the future, you can also click Uninstall from this screen; please contact your Account Manager if you wish to stop using this feature so we can review your billing arrangements.





Did this answer your question?