GoCardless
GoCardless Integration Guide
GoCardless allows you to collect Direct Debit payments from Eurozone for recurring or one-time payments.
Learn more about GoCardless
The first thing that you have to do is to create an Octobat account.
Then, you have to own a GoCardless account either in sandbox mode or in live mode.
To ensure that all your invoices are correctly generated, you must follow the way of this guide to make GoCardless API calls.
GoCardless Connect App Screenshot
During your registration, you will be able to connect your GoCardless sandbox account and your GoCardless live account.
The best way for testing the GoCardless integration with Octobat is to connect a GoCardless sandbox account, test (make API calls or create some objects within your GoCardless dashboard) and look what is happening on Octobat.
This Octobat integration is based on the GoCardless API.
Octobat uses some GoCardless basic fields to generate compliant invoices and calculate right taxes. But all these fields are not sufficients, so Octobat uses metadata fields.
Ruby
Second Tab
Install the gem 'gocardless_pro'
gem install gocardless_pro
In the case of a B2C customer:
require 'gocardless_pro'
@client = GoCardlessPro::Client.new(
access_token: "your_access_token",
environment: :sandbox
)
@client.customers.create(
params: {
email: "[email protected]",
given_name: "John",
family_name: "Doe",
address_line1: "151 rue Montmartre",
city: "Paris",
postal_code: "75002",
region: "",
country_code: "FR",
:metadata => {
:business_type => "B2C"
}
}
)
In the case of a B2B customer:
require 'gocardless_pro'
@client = GoCardlessPro::Client.new(
access_token: "your_access_token",
environment: :sandbox
)
@client.customers.create(
params: {
email: "[email protected]",
company_name: "Flatchr",
address_line1: "18 bis rue de Chartres",
city: "Neuilly sur seine",
postal_code: "92200",
region: "",
country_code: "FR",
:metadata => {
:business_type => "B2B",
:tax_number => "FR13803289560"
}
}
)
require 'gocardless_pro'
@client = GoCardlessPro::Client.new(
access_token: "your_access_token",
environment: :sandbox
)
@client.payments.create(
params: {
amount: 1000,
currency: "EUR",
charge_date: "2016-11-28",
description: "One-time charge",
links: {
mandate: "MD123"
},
:metadata => {
:notes => "Notes that will be display on the bottom of the invoice.",
:product_type => "eservice"
}
}
)
require 'gocardless_pro'
@client = GoCardlessPro::Client.new(
access_token: "your_access_token",
environment: :sandbox
)
@client.refunds.create(
params: {
amount: 100,
total_amount_confirmation: 100
links: {
payment: "PM123"
},
:metadata => {
:reason => "Late delivery.",
:notes => "Notes that will be display on the bottom of the invoice.",
:product_type => "eservice"
}
}
)
require 'gocardless_pro'
@client = GoCardlessPro::Client.new(
access_token: "your_access_token",
environment: :sandbox
)
@client.subscriptions.create(
params: {
amount: 2500,
currency: "EUR",
name: "Monthly streaming videos plan",
interval_unit: "monthly",
day_of_month: 1,
links: {
mandate: "MD123"
},
:metadata => {
:notes => "This is notes which will display on the bottom of the invoice.",
:product_type => "eservice"
}
}
)
Field Name | Field Values | | Default Value |
product type | eservice, standard or ebook | optional | |
business_type | B2C or B2B | optional | B2C and B2B if vat number is filled |