GoCardlessDeveloper Docs
Create a sandbox account

Creating a Creditor#

View as Markdown

In this step of the GoCardless Embed guide you will create a creditor to represent one of your merchants.

By having a creditor for each merchant you will be able to pay out separately for each creditor, customise the beneficiary name the payer sees, and perform reconciliation on a per-merchant basis.

POST /creditors#

You can create a creditor by performing a POST request to the /creditors endpoint. The required parameters are:

ParameterDescription
nameThe trading name of the creditor.
creditor_typeThe type of business of the creditor. One of: individual, company, charity, partnership, and trust.
country_codeThe country that the creditor is registered in, as a ISO 3166-1 alpha-2 code.

Examples of how to make this request using the GoCardless client libraries:

POST https://api.gocardless.com/creditors HTTP/1.1
Content-Type: application/json
{
"creditors": {
  "name": "Example Ltd",
  "country_code": "GB",
  "creditor_type": "company"
}
}

HTTP/1.1 201 Created
Location: /creditors/CR123
Content-Type: application/json
{
"creditors": {
"id": "CR123",
"created_at": "2017-02-16T12:34:56.000Z",
"name": "Example Ltd",
"creditor_type": "company",
"country_code": "GB",
...
}
}
$client = new \GoCardlessPro\Client([
'access_token' => 'your_access_token_here',
'environment' => \GoCardlessPro\Environment::SANDBOX
]);

$client->creditors()->create([
'params' => [
'name' => 'Example Ltd',
'country_code' => 'GB',
'creditor_type' => 'company'
]
]);
import gocardless_pro
client = gocardless_pro.Client(access_token="your_access_token_here", environment='sandbox')

client.creditors.create(params={
"name": "Example Ltd",
"country_code": "GB",
"creditor_type": "company"
})
@client = GoCardlessPro::Client.new(
access_token: "your_access_token",
environment: :sandbox
)

@client.creditors.create(
params: {
name: "Example Ltd",
country_code: "GB",
creditor_type: "company"
}
)
import static com.gocardless.GoCardlessClient.Environment.SANDBOX;
String accessToken = "your_access_token_here";
GoCardlessClient client = GoCardlessClient
.newBuilder(accessToken)
.withEnvironment(SANDBOX)
.build();

Creditor creditor = client.creditors().create()
.withName("Example Ltd")
.withCountryCode("GB")
.withCreditorType("company")
.execute();
const constants = require("gocardless-nodejs/constants");
const gocardless = require("gocardless-nodejs");
const client = gocardless(
"your_access_token_here",
constants.Environments.Sandbox,
);

const creditor = await client.creditors.create({
name: "Example Ltd",
country_code: "GB",
creditor_type: "company",
});
String accessToken = "your_access_token";
GoCardlessClient gocardless = GoCardlessClient.Create(accessToken, Environment.SANDBOX);

var creditorRequest = new GoCardless.Services.CreditorCreateRequest()
{
Name = "Example Ltd",
CountryCode = "GB",
CreditorType = "company",
};

var creditorResponse = await gocardless.Creditors.CreateAsync(creditorRequest);
GoCardless.Resources.Creditor creditor = creditorResponse.Creditor;
package main

import (
gocardless "github.com/gocardless/gocardless-pro-go/v6"
)

accessToken := "your_access_token_here"
config, err := gocardless.NewConfig(accessToken, gocardless.WithEndpoint(gocardless.SandboxEndpoint))
if err != nil {
fmt.Printf("got err in initialising config: %s", err.Error())
return
}
client, err := gocardless.New(config)
if err != nil {
fmt.Println("error in initialisating client: %s", err.Error())
return
}

creditorCreateParams := gocardless.CreditorCreateParams{
Name: "Example Ltd",
CountryCode: "GB",
CreditorType: "company",
}

creditor, err := client.Creditors.Create(context, creditorCreateParams)
curl --silent \
-H "Content-Type: application/json" \
-H "Gocardless-Version: 2015-07-06" \
-H "Authorization: Bearer ${API_ACCESS_TOKEN}" \
"https://api.gocardless.com/creditors" \
-d @- << EOF
{
"creditors": {
"name": "Example Ltd",
"country_code": "GB",
"creditor_type": "company"
}
}
EOF

The API will respond with a creditor object containing a creditor ID starting with 'CR'. This ID will be used in subsequent steps.

For more details, see the API reference docs for this endpoint.

What's next?#