How to integrate with the GoCardless API

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 simple steps and our easy to use API libraries.

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

2. 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. We maintain libraries in Java, Python, Ruby, PHP, and .NET.

3. Create a read-write access token through the Developer section of your sandbox dashboard. You’ll use this access token when sending any requests to the GoCardless API.

4. Take a look through our developer documentation - we have a getting started guide, and a full API reference. We’ll show you code examples for each request in your preferred language on the right hand side for each endpoint.

5. Create a redirect flow - using your chosen client library. This enables you to use GoCardless’ hosted payment pages to set up mandates with your customers. These pages are fully compliant and translated into Dutch, French, German, Italian, Portuguese, Spanish and Swedish. The complete flow is:

  • You create a redirect flow for your customer, and redirect them to the returned redirect url e.g. https://pay.gocardless.com/flow/RE123.
  • Your customer supplies their name, email, address, and bank account details, and submits the form. This securely stores their details, and redirects them back to your success_redirect_url with redirect_flow_id=RE123 in the query string.
  • You complete the redirect flow, which creates a customer, customer bank account, and mandate, and returns the ID of the mandate. You may wish to create a subscription or payment at this point.

If you’re going to be using GoCardless Pro, you can create your own custom payment pages and host these on your own website. You can find more information on this here.

6. Once you’ve created a couple of test customers, you may want to create some payments and subscriptions for them. You’ll need to use the customer’s mandate ID you received in the redirect flow to create a payment.

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 with GoCardless then please visit our help centre or feel free to email us.

Get started with our API
Visit the developer site