Customer Manipulation
A customer record captures the personal and banking details of the person or organisation that you wish to collect funds from. A customer record needs to be created before a Direct Debit (contract) record can be created to collect payments. There can be multiple Direct Debits (contracts) attached to a customer record.
GET/client/{clientCode}/customerQueries the database for a set of customers#
NOTE: The response from a GET method includes an IsArchived flag. On a newly created customer, this will show as true which is normal. The record will automatically change to false when an associated live Direct Debit (contract) is attached to it.
directDebit/path/client- clientCode
- pageSize
- pageNumber
- includePagingDetail
- includeMemos
- email
- title
- from
- to
- dateOfBirth
- customerRef
- firstName
- surname
- companyName
- postCode
- accountNumber
- bankSortCode
- accountHolderName
- homePhoneNumber
- workPhoneNumber
- mobilePhoneNumber
Responses
200OK
- Customers [ {
- AddressDetail {
- Line1
- Line2
- Line3
- Line4
- PostCode
} - BankDetail {
- AccountHolderName
- AccountNumber
- BankSortCode
} - CompanyName
- CustomerRef
- DateAdded
- DateOfBirth
- Email
- FirstName
- HomePhoneNumber
- Id
- IsArchived
- Memos [ {
- At
- Body
- ContractRef
} ] - MobilePhoneNumber
- Surname
- Title
- WorkPhoneNumber
} ] - Metadata {
- TotalPages
- TotalRecords
- PageSize
- PageNumber
}
Example request
GET /client/{clientCode}/customercurl -L -g -X GET 'https://ddcms.accesspaysuite.com/api/v3/client/{clientCode}/customer' -H 'apiKey: {apiKey}'HTTP/1.1 200 OK
{
"AddressDetail": {
"Line1": "1 Tebbit Mews",
"Line2": "Winchcombe Street",
"Line3": "Cheltenham",
"PostCode": "A1 1AA"
},
"BankDetail": {
"AccountHolderName": "Access Paysuite",
"AccountNumber": "01065285",
"BankSortCode": "309906"
},
"CompanyName": "Access Paysuite",
"CustomerRef": "AE102890",
"DateAdded\"": "2017-04-12T13:22:48.800Z",
"DateOfBirth": "2017-01-01T00:00:00.000Z",
"Email": "[email protected]",
"FirstName": "Matthew",
"HomePhoneNumber": "01234567890",
"Id": "c36ce83c-0064-4c1e-a157-cd4c70decf47",
"IsArchived": true,
"Memos": [],
"Surname": "Harris",
"Title": "Mr"
}POST/client/{clientCode}/customerCreates a customer in the database#
Creates a customer record — the personal and banking details of the person or organisation you will collect from. A customer must exist before a contract can be created against it.
directDebit/path/client- clientCode
- email
- title
- dateOfBirth
- customerRef
- firstName
- surname
- companyName
- postCode
- accountNumber
- bankSortCode
- accountHolderName
- homePhoneNumber
- workPhoneNumber
- mobilePhoneNumber
- line1
- line2
- line3
- line4
- initials
- customerLocale
- Email
- Title
- CustomerRef
- FirstName
- Surname
- Line1
- Line2
- PostCode
- AccountNumber
- BankSortCode
- AccountHolderName
Responses
200OK
- Id
- customerRef
400Bad Request
- Message
Example — query parameters
POST /client/{clientCode}/customercurl -L -g -X POST 'https://ddcms.accesspaysuite.com/api/v3/client/{clientCode}/[email protected]&title=Mr&customerRef=999999&firstName=John&surname=Doe&line1=1 Tebbit Mews&postCode=GL52 2NF&accountNumber=12345678&bankSortCode=123456&accountHolderName=Mr John Doe' \
-H 'apiKey: {apiKey}'HTTP/1.1 200 OK
{
"CustomerRef": "AE102888",
"Id": "12f5734a-bfc3-45f2-9edd-44d4a05cf751"
}HTTP/1.1 400 Bad Request
{
"ErrorCode": 2,
"Message": "Customer email is mandatory for this client"
}Example — request body
POST /client/{clientCode}/customer{
"Email": "[email protected]",
"Title": "Mr",
"CustomerRef": "999999",
"FirstName": "John",
"Surname": "Doe",
"Line1": "1 Tebbit Mews",
"Line2": "Winchcombe Street",
"PostCode": "GL52 2NF",
"AccountNumber": "12345678",
"BankSortCode": "123456",
"AccountHolderName": "Mr John Doe"
}curl -L -g -X POST 'https://ddcms.accesspaysuite.com/api/v3/client/{clientCode}/customer' \
-H 'Content-Type: application/json' \
-H 'apiKey: {apiKey}' \
-d '{"Email":"[email protected]","Title":"Mr","CustomerRef":"999999","FirstName":"John","Surname":"Doe","Line1":"1 Tebbit Mews","Line2":"Winchcombe Street","PostCode":"GL52 2NF","AccountNumber":"12345678","BankSortCode":"123456","AccountHolderName":"Mr John Doe"}'HTTP/1.1 200 OK
{
"CustomerRef": "AE102888",
"Id": "12f5734a-bfc3-45f2-9edd-44d4a05cf751"
}HTTP/1.1 400 Bad Request
{
"ErrorCode": 2,
"Message": "Customer email is mandatory for this client"
}GET/client/{clientCode}/customer/{customerId}Queries the database for a single customer by ID#
NOTE: The response from a GET method includes an IsArchived flag. On a newly created customer, this will show as true which is normal. The record will automatically change to false when an associated live Direct Debit (contract) is attached to it.
directDebit/path/client-customer- clientCode
- customerId
Responses
200OK
- AddressDetail {
- Line1
- Line2
- Line3
- Line4
- PostCode
} - BankDetail {
- AccountHolderName
- AccountNumber
- BankSortCode
} - CompanyName
- CustomerRef
- DateAdded
- DateOfBirth
- Email
- FirstName
- HomePhoneNumber
- Id
- IsArchived
- Memos [ {
- At
- Body
- ContractRef
} ] - MobilePhoneNumber
- Surname
- Title
- WorkPhoneNumber
Example request
GET /client/{clientCode}/customer/{customerId}curl -L -g -X GET 'https://ddcms.accesspaysuite.com/api/v3/client/{clientCode}/customer/c36ce83c-0064-4c1e-a157-cd4c70decf47' -H 'apiKey: {apiKey}'HTTP/1.1 200 OK
{
"AddressDetail": {
"Line1": "1 Tebbit Mews",
"Line2": "Winchcombe Street",
"Line3": "Cheltenham",
"PostCode": "A1 1AA"
},
"BankDetail": {
"AccountHolderName": "Access Paysuite",
"AccountNumber": "01065285",
"BankSortCode": "309906"
},
"CompanyName": "Access Paysuite",
"CustomerRef": "AE102890",
"DateAdded\"": "2017-04-12T13:22:48.800Z",
"DateOfBirth": "2017-01-01T00:00:00.000Z",
"Email": "[email protected]",
"FirstName": "Matthew",
"HomePhoneNumber": "01234567890",
"Id": "c36ce83c-0064-4c1e-a157-cd4c70decf47",
"IsArchived": true,
"Memos": [],
"Surname": "Harris",
"Title": "Mr"
}HTTP/1.1 404 Not Found
{
"Message": "API not enabled"
}PATCH/client/{clientCode}/customer/{customerId}Updates (or partially updates) an existing customer in the database#
Updates, or partially updates, an existing customer record. Send only the fields you want to change.
directDebit/path/client-customer- clientCode
- customerId
- email
- title
- dateOfBirth
- customerRef
- firstName
- surname
- companyName
- postCode
- accountNumber
- bankSortCode
- accountHolderName
- homePhoneNumber
- workPhoneNumber
- mobilePhoneNumber
- line1
- line2
- line3
- line4
- initials
- customerLocale
{} — This call takes no request body — send an empty JSON object.
Responses
200OK
- Message
Example request
PATCH /client/{clientCode}/customer/{customerId}{}curl -L -g -X PATCH 'https://ddcms.accesspaysuite.com/api/v3/client/{clientCode}/customer/[email protected]' -H 'apiKey: {apiKey}'HTTP/1.1 200 OK
{
"Message": "Customer updated"
}PATCH/client/{clientCode}/customer/{customerId}/editUpdates an existing customer using a JSON request body#
Updates, or partially updates, an existing customer record by sending a JSON body. Send only the fields you want to change.
directDebit/path/client-customer- clientCode
- customerId
- Email
- Title
- DateOfBirth
- CustomerRef
- FirstName
- Surname
- CompanyName
- PostCode
- AccountNumber
- BankSortCode
- AccountHolderName
- HomePhoneNumber
- WorkPhoneNumber
- MobilePhoneNumber
- Line1
- Line2
- Line3
- Line4
- Initials
- CustomerLocale
Responses
200OK
- Message
Example request
PATCH /client/{clientCode}/customer/{customerId}/edit{
"Email": "[email protected]",
"FirstName": "John",
"Surname": "Doe"
}curl -L -g -X PATCH 'https://ddcms.accesspaysuite.com/api/v3/client/{clientCode}/customer/dfca6da1-2490-4607-a256-c5799d2584e9/edit' \
-H 'Content-Type: application/json' \
-H 'apiKey: {apiKey}' \
-d '{"Email":"[email protected]","FirstName":"John","Surname":"Doe"}'HTTP/1.1 200 OK
{
"Message": "Customer updated"
}Error handling
Errors are presented back in the JSON or XML response in human readable form. Two are common enough to design for.
| Error | Explanation | Resolution |
|---|---|---|
| There is an existing Customer with the same Client and Customer ref in the database already. | The customer reference must be unique; a customer with the customerRef you passed already exists. | Check the customer does not already exist; if not, use another unique customerRef. |
| Invalid Postcode. The postcode must have 5, 6 or 7 characters only. | The postcode supplied is not in a correct UK format. | UK postcodes are formed as A99 9AA, AA99 9AA or AA9A 9AA, where A is a capital letter [A-Z] and 9 is a number [0-9]. |