How to integrate with the GoCardless API
By Nicola PellattMay 20182 min read
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.
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.
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
redirect_flow_id=RE123in 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.
GoCardless is used by over 55,000 businesses around the world. Learn more about how you can improve payment processing at your business today.