in Support

How to integrate with the GoCardless API

This post relates to the Legacy GoCardless API. If you're starting a new integration, you'll need to use the new GoCardless API - for help getting started, check out our guide.

What is the GoCardless API?

The GoCardless API is a way for developers to interact via software with GoCardless, allowing you to integrate us into your website, mobile app or desktop software. This means you can build your own customised integration to automate payment collection and reconciliation.

What do you need to do to integrate with the GoCardless API?

Integrating with the GoCardless API is incredibly simple and can be done in minutes with the following 8 simple steps and our easy to use API libraries.

1. Sign up for a merchant account if you haven’t already - it’ll only take a minute to create your account. If you already have a merchant account, just log in to your dashboard.

GoCardless sign up page

2. Log in to your dashboard and enable developer mode. To do this, click 'More…' in the navigation bar, then click 'Developer' and finally, click the 'Enable developer mode' button. We will then create a sandbox environment for you to test in and set you up with your API credentials.

Developer mode

3. Switch to the sandbox. To do this click 'Sandbox' near the top right of the dashboard to switch between the live and sandbox dashboards (to switch back simply click 'Live'). Once you have switched to the sandbox, click 'More…'' then 'Developer' to find your sandbox API credentials.

Sandbox API credentials

4. Download one of our API client libraries for the language you’ll be developing in. These libraries take all the hard work out of using our API, so you’ll only need a few lines of code to get started.

5. Take a look through our developer documentation - use the drop-down list at the top left of the page to select the library you’re using, and we’ll show you code examples for your preferred language.

6. Create a link for a one-off bill, subscription or pre-authorisation using your chosen client library. You’ll use your sandbox credentials to generate the link, so none of the payments you create will be sent to the banking system. The link you generate will take the customer to an online Direct Debit mandate form where they will need to enter their payment details.

Direct Debit mandate form

7. Make a confirmation page on your website (if you'd like to). The customer will be redirected here when they’ve completed the online Direct Debit mandate form. You’ll need to confirm that they’ve reached you successfully and that you’ve received the details of the payment they’ve set up. Our libraries make this simple to do, just read through the confirming payments section of our documentation.

Direct Debit setup successful message

8. Now test it out. Try following the link you’ve generated and set up a sandbox payment to your merchant account. If it all works as expected, you can go back to your live dashboard and get your live API credentials - switch the sandbox credentials for the live ones in your code.

You’re now ready to start taking payments using Direct Debit!

Depending on your needs, you may want to start receiving automatic notifications to your system when the status of a payment changes. We can send webhooks to your server to keep you up-to-date with your payments as they are processed - read through our webhook guide to find out how to add this to your application flow.

If you need any advice on how to integrate GoCardless then please feel free to email us.

Interested in collecting Direct Debits?
Book a chat with an expert
By using this site you agree to the use of cookies for analytics, personalised content and ads. Learn more