Creating a customer
This page will show you how to create a new customer
A customer is a business owning the account. In API-terms they are a 'Trader'. An explanation of what Traders are can be found here
This page will explain how to create a customer by API and has the following sections:
- Creating a new customer
- Updating customer details
- Getting customer details
- Uploading documents for relevant individuals
- Downloading a document
When creating a customer you do not automatically request a bank account for them. How to request a bank account is described here.
Creating a new customer
A supplier can be created like this:
curl {baseURL}/traders
-H "Content-type: application/json"
-H "Accept: application/json"
-X POST
-d '{
"user": {
"email": "[email protected]"
},
"companyTradingName": "Company name",
"companyTradingAddress": {
"address1": "44 Valley Street",
"postalCode": "94110",
"city": "San Francisco",
"state": "CA",
"countryCode": "US"
},
"companyType": "Limited",
"resellerId": "id of the reseller",
"registrationNumber": "12345678",
"vatNumber": "GB265111111",
"website": "https://www.mycompany.com",
"relevantIndividuals": [
{
"role": "OWNER",
"name": "Anna Barking",
"dateOfBirth": "1985-03-23",
"email": "[email protected]",
"pctOwnership": "30",
"address": {
"address1": "16 Grosvenor Close",
"postalCode": "W2 6GH",
"city": "London",
"state": "London",
"countryCode": "GB"
}
}
]
}'
An explanation of all fields can be found here.
An account can be created with the user and companyTradingName fields only but all data is required for us to start the onboarding process.
The response to this request will look like this:
{
"id": ":trader_id",
"companyTradingName": "Company name",
"companyTradingAddress": {
"address1": "44 Valley Street",
"postalCode": "94110",
"city": "San Francisco",
"state": "CA",
"countryCode": "US"
},
"companyType": "Limited",
"resellerId": "id of the reseller",
"registrationNumber": "12345678",
"vatNumber": "GB265111111",
"website": "https://www.mycompany.com",
"relevantIndividuals": [
{
"id": "relevant individual id",
"role": "OWNER",
"name": "Anna Barking",
"dateOfBirth": "1985-03-23",
"email": "[email protected]",
"pctOwnership": "30",
"address": {
"address1": "16 Grosvenor Close",
"postalCode": "W2 6GH",
"city": "London",
"state": "London",
"countryCode": "GB"
}
}
]
}
The id is used to update the trader and get trader details.
Updating customer details
To provide additional information about a customer, you can call this API
curl {baseURL}/traders/:trader_id
-H "Content-type: application/json"
-H "Accept: application/json"
-H "Authorization:your-api-key"
-X PUT
-d '{
"companyTradingName": "Company name",
"companyTradingAddress": {
"address1": "44 Valley Street",
"postalCode": "94110",
"city": "San Francisco",
"state": "CA",
"countryCode": "US"
},
"companyType": "Limited",
"registrationNumber": "12345678",
"vatNumber": "GB265111111",
"website": "https://www.mycompany.com",
"relevantIndividuals": [
{
"id": "relevant individual id",
"role": "OWNER",
"name": "Anna Barking",
"dateOfBirth": "1985-03-23",
"email": "[email protected]",
"pctOwnership": "30",
"address": {
"address1": "16 Grosvenor Close",
"postalCode": "W2 6GH",
"city": "London",
"state": "London",
"countryCode": "GB"
}
}
]
}'
Full details required
When updating a customer's details you need to provide full details. Any details previously stored but not provided in the PUT will be deleted.
Getting customer details
You can get customer details like this:
curl {baseURL}/traders/trader-id
-H "Content-type: application/json"
-H "Authorization:your-api-key"
-X GET
If you don't have the id, you can also search for a customer:
curl {baseURL}/traders?q=<company name>
-H "Content-type: application/json"
-H "Authorization:your-api-key"
-X GET
The company name search string should be at least three characters long.
Uploading documents for relevant Individuals
Documents for a relevant individual can be uploaded using the following API
curl {baseURL}/traders/{traderId}/relevantIndividuals/{relevantIndividualId}/documents
-H "Content-type: application/json"
-H "Accept: application/json"
-H "Authorization:your-api-key"
-X POST
-d '{
"fileName": "Name of the file",
"type": "PASSPORT/PROOF_OF_ADDRESS",
"base64EncodedContent": "base64 encoded content"
}'
An explanation of all fields can be found here
The response to this request will look like this:
{
"id": "Id of the document",
"documentId": "id of the uploaded file",
"location": "download location of document",
"fileName": "Name of the file",
"type": "PASSPORT/PROOF_OF_ADDRESS"
}
The location is used to download the document.
Uploading multiple documents of same type
When uploading a document which already exists then the new document replaces the old.
Downloading a document
This is how to download a document:
curl {location of the document}
-H "Content-type: application/json"
-H "Accept: application/json"
-H "Authorization:your-api-key"
The response will have the following headers, which will allow you to save the document:
Header name | Value |
---|---|
content-disposition | attachment;filename= |
content-length | |
content-type | application/octet-stream |
Updated over 1 year ago