ClearBank

Bacs Direct Debit Instructions

Direct Debit Instructions

A Direct Debit Instruction (DDI) is an authorisation to collect future payments from a nominated account. A DDI can be submitted to ClearBank by service users in two ways:

  • Electronically via the Bacs Automated Direct Debit Instruction Service (AUDDIS), or,
  • Sent as a paper instruction to your address to be entered via the ClearBank API after you have validated it.

A DDI can be set up against a real or virtual account held with ClearBank. It cannot be set up against a General Segregated Account, your Bacs Suspense Account, or your Minimum Mandated Balance account. You will receive the Bacs Mandate Initiated webhook once the DDI is present in our system.

If you are transferring an existing sort code to ClearBank that already has DDIs set up, you will need to use the API to inform us of these.

Once a DDI has been set up against an account via AUDDIS, payments may be collected from the account from the third day; for paper instructions, payments may be collected from the following day. The timing of the payment is in the control of the service user and does not necessarily follow immediately.

To receive feedback during DDI management, subscribe to the relevant webhooks which are listed here: BACS DDI webhooks.

Note: Occasionally you might receive a Bacs Mandate Cancellation Failed webhook, after having cancelled a Direct Debit Instruction through the DELETE endpoints. This does not necessarily mean a real failure. This situation can arise as in the following example:

An end-customer cancels their phone contract with "FabuPhone". FabuPhone immediately cancel the DDI through the Bacs system. The end-customer also requests that you cancel the DDI, and you attempt to do so using the DELETE endpoint. As the instruction was already cancelled, it no longer exists and cannot be found. You will then receive a Bacs Mandate Cancellation Failed webhook.
You can use the GET endpoint (GET /{vn}/Accounts/{accountId}/Mandates) to check the DDIs in place for the account and verify that everything is as it should be.

Dormant Direct Debit Instructions

Please note that ClearBank also performs weekly dormancy checks on Direct Debit Instructions set up against your accounts. After a set period of inactivity against a DDI, the instruction will be marked as Cancelled and further payment will not be processed.

By default, a DDI must be dormant for 24 months before it is automatically flagged for cancellation. However, this period can be extended by the service user in agreement with their sponsor bank. ClearBank uses the current value from the latest Direct Debit Originator (DDO) Database maintained by Pay.UK when we run the dormancy check.

If a Direct Debit is cancelled due to dormancy but is still required, the service user will need to arrange to send a new instruction.

Manage DDIs for real accounts

Create a DDI (real account)

post/v1/Accounts/{accountId}/Mandates

This endpoint is used if you have received a validated Paper DDI and need to inform ClearBank of its existence, or if transferring a sort code that has existing DDIs lodged. All other DDIs are set up through AUDDIS.

Requests creation of a Direct Debit Instruction

This endpoint uses a combination of the SUN and reference as a duplicate check and to ensure the request is idempotent.

Parameters

  • accountId string, path, Required

    The unique identifier for the account. This can be retrieved from GET /v1/Accounts

  • Authorization string, header, Required

    Your API Token, retrieved from the web portal

  • DigitalSignature string, header, Required

    Signed hash of the body of the request. The hash is signed by your private key

  • X-Request-Id string, header, Required

    A unique identifier for the request

Request Payload (application/json)

  • serviceUserNumber string, Required

    The service user number.

    Pattern
    ^\d{6}$
  • originatorName string

    The originator name.

    Minimum length
    0
    Maximum length
    18
    Pattern
    ^[A-Z0-9\.\&\/\-\ ]*$
  • reference string, Required

    The Service User's reference.

    Minimum length
    1
    Maximum length
    18
    Pattern
    ^[A-Z0-9\.\&\/\-\ ]*$
  • payerName string

    The payer name.

    Minimum length
    0
    Maximum length
    18
    Pattern
    ^[A-Z0-9\.\&\/\-\ ]*$
  • counterpartAccount object

    Information about the counterpart in a given transaction

  • mandateType string

    The specified Instruction type for the request. This will usually be “PaperMandate”. You will only use “Origination” and “Migrated” if you are transferring a sort code from another Direct Participant to the ClearBank domain. “Migrated” indicates that the DDI was initially received as a paper item but later re-lodged in AUDDIS format by the Service User.

    Enum array
    PaperMandate, Origination, Migrated

request

{
"serviceUserNumber": "string",
"originatorName": "string",
"reference": "string",
"payerName": "string",
"counterpartAccount": {
"identification": {
"iban": "string",
"other": {
"identification": "string",
"schemeName": {
"code": "BBAN",
"proprietary": "string"
},
"issuer": "string"
}
}
},
"mandateType": "PaperMandate"
}
Code copied

Response (application/json)

  • 202 Success
  • 400 Bad Request
  • 403 Forbidden
  • 404 Not Found
  • 500 Server Error
  • 503 Server Error

Success

{
"halLinks": [
{
"name": "string",
"href": "string",
"templated": true
}
]
}
Code copied

Bad Request

{
"errors": {
"property1": [
"string"
],
"property2": [
"string"
]
},
"type": "string",
"title": "string",
"status": 0,
"detail": "string",
"instance": "string"
}
Code copied

Get all DDIs (real account)

get/v2/Accounts/{accountId}/Mandates

Gets all of the Direct Debit Instructions associated with the account.

Parameters

  • accountId string, path, Required

    The unique identifier for the account. This can be retrieved from GET /V2/Accounts.

  • pageNumber integer, query

    The page number to control returned results into manageable sets. Default if not supplied: 1.

  • pageSize integer, query

    The page size to control returned results into manageable sets. Default if not supplied: 50.

  • Authorization string, header, Required

    Your API Token, retrieved from the web portal.

Response (application/json)

  • 200 Success
  • 400 Bad Request
  • 403 Forbidden
  • 409 Conflict
  • 500 Server Error
  • 503 Server Error

Success

{
"directDebitMandates": [
{
"mandateId": "d4dbf0da-b5aa-43ae-b9db-c2aff331d3ad",
"payerName": "string",
"payerBban": "string",
"payerAccountNumber": "string",
"payerSortCode": "string",
"reference": "string",
"serviceUserNumber": "string",
"originatorName": "string",
"mandateType": "PaperMandate",
"state": "Active"
}
],
"halLinks": [
{
"name": "string",
"href": "string",
"templated": true
}
]
}
Code copied

Bad Request

{
"errors": {
"property1": [
"string"
],
"property2": [
"string"
]
},
"type": "string",
"title": "string",
"status": 0,
"detail": "string",
"instance": "string"
}
Code copied

Amend a DDI (real account)

patch/v1/Accounts/{accountId}/Mandates/{mandateId}

Requests amendments to Direct Debit Instruction

Supported reason codes are: C - Account transfered to a different branch of bank/building society E - Instruction amended

Parameters

  • accountId string, path, Required

    The unique identifier for the account. This can be retrieved from GET /v1/Accounts

  • mandateId string, path, Required

    The unique Direct Debit Instruction identifier

  • Authorization string, header, Required

    Your API Token, retrieved from the web portal

  • DigitalSignature string, header, Required

    Signed hash of the body of the request. The hash is signed by your private key

  • X-Request-Id string, header, Required

    A unique identifier for the request

Request Payload (application/json)

  • reasonCode string, Required

    Reason code for requesting the amendment

    Pattern
    ^[EC]{1}$
  • newDebtorAccount object, Required

    Information about the counterpart in a given transaction

request

{
"reasonCode": "string",
"newDebtorAccount": {
"identification": {
"iban": "string",
"other": {
"identification": "string",
"schemeName": {
"code": "BBAN",
"proprietary": "string"
},
"issuer": "string"
}
}
}
}
Code copied

Response (application/json)

  • 202 Success
  • 400 Bad Request
  • 403 Forbidden
  • 404 Not Found
  • 500 Server Error
  • 503 Server Error

Success

{
"halLinks": [
{
"name": "string",
"href": "string",
"templated": true
}
]
}
Code copied

Bad Request

{
"errors": {
"property1": [
"string"
],
"property2": [
"string"
]
},
"type": "string",
"title": "string",
"status": 0,
"detail": "string",
"instance": "string"
}
Code copied

Return a DDI (real account)

post/v1/Accounts/{accountId}/Mandates/{mandateId}/Returns

Requests rejection for the supplied Direct Debit Instruction identifier

Parameters

  • accountId string, path, Required

    The unique identifier for the account. This can be retrieved from GET /v1/Accounts

  • mandateId string, path, Required

    The unique Direct Debit Instruction identifier

  • Authorization string, header, Required

    Your API Token, retrieved from the web portal

  • DigitalSignature string, header, Required

    Signed hash of the body of the request. The hash is signed by your private key

  • X-Request-Id string, header, Required

    A unique identifier for the request

Request Payload (application/json)

  • rejectionReason string, Required

    The reason why the DDI is being returned

    Pattern
    ^[BCFGHIK12356]{1}$

request

{
"rejectionReason": "string"
}
Code copied

Response (application/json)

  • 202 Success
  • 400 Bad Request
  • 403 Forbidden
  • 409 Conflict
  • 500 Server Error
  • 503 Server Error

Success

{
"halLinks": [
{
"name": "string",
"href": "string",
"templated": true
}
]
}
Code copied

Bad Request

{
"errors": {
"property1": [
"string"
],
"property2": [
"string"
]
},
"type": "string",
"title": "string",
"status": 0,
"detail": "string",
"instance": "string"
}
Code copied

Cancel a DDI (real account)

delete/v1/Accounts/{accountId}/Mandates/{mandateId}

Requests cancellation for a Direct Debit mandate

Supported reason codes are:
0 - Institution cancelled - refer to payer. Paying bank has cancelled instruction.
1 - Instruction cancelled by payer. Payer has instructed the paying bank to cancel the DirectDebit Instruction.
2 - Payer deceased.
B - Account closed. Payer has closed their account for an unknown reason.

Parameters

  • accountId string, path, Required

    The unique identifier for the account. This can be retrieved from GET /v1/Accounts

  • mandateId string, path, Required

    The unique Direct Debit Instruction identifier

  • Authorization string, header, Required

    Your API Token, retrieved from the web portal

  • DigitalSignature string, header, Required

    Signed hash of the body of the request. The hash is signed by your private key

  • X-Request-Id string, header, Required

    A unique identifier for the request

Request Payload (application/json)

  • reasonCode string, Required

    The reason code

    Pattern
    ^[0-2B]{1}$

request

{
"reasonCode": "string"
}
Code copied

Response (application/json)

  • 202 Success
  • 400 Bad Request
  • 403 Forbidden
  • 404 Not Found
  • 500 Server Error
  • 503 Server Error

Success

{
"halLinks": [
{
"name": "string",
"href": "string",
"templated": true
}
]
}
Code copied

Bad Request

{
"errors": {
"property1": [
"string"
],
"property2": [
"string"
]
},
"type": "string",
"title": "string",
"status": 0,
"detail": "string",
"instance": "string"
}
Code copied

Manage DDIs for virtual accounts

Create a DDI (virtual account)

post/v1/Accounts/{accountId}/Virtual/{virtualAccountId}/Mandates

This endpoint is used if you have received a validated Paper DDI and need to inform ClearBank of its existence, or if transferring a sort code that has existing DDIs lodged. All other DDIs are set up through AUDDIS.

Requests creation of a Direct Debit Instruction

This endpoint uses a combination of the SUN and reference as a duplicate check and to ensure the request is idempotent.

Parameters

  • accountId string, path, Required

    The unique identifier for the account. This can be retrieved from GET /v1/Accounts

  • virtualAccountId string, path, Required

    The unique identifier for the virtual account. This can be retrieved from GET /v1/Accounts/{accountId}/Virtual

  • Authorization string, header, Required

    Your API Token, retrieved from the web portal

  • DigitalSignature string, header, Required

    Signed hash of the body of the request. The hash is signed by your private key

  • X-Request-Id string, header, Required

    A unique identifier for the request

Request Payload (application/json)

  • serviceUserNumber string, Required

    The service user number.

    Pattern
    ^\d{6}$
  • originatorName string

    The originator name.

    Minimum length
    0
    Maximum length
    18
    Pattern
    ^[A-Z0-9\.\&\/\-\ ]*$
  • reference string, Required

    The Service User's reference.

    Minimum length
    1
    Maximum length
    18
    Pattern
    ^[A-Z0-9\.\&\/\-\ ]*$
  • payerName string

    The payer name.

    Minimum length
    0
    Maximum length
    18
    Pattern
    ^[A-Z0-9\.\&\/\-\ ]*$
  • counterpartAccount object

    Information about the counterpart in a given transaction

  • mandateType string

    The specified Instruction type for the request. This will usually be “PaperMandate”. You will only use “Origination” and “Migrated” if you are transferring a sort code from another Direct Participant to the ClearBank domain. “Migrated” indicates that the DDI was initially received as a paper item but later re-lodged in AUDDIS format by the Service User.

    Enum array
    PaperMandate, Origination, Migrated

request

{
"serviceUserNumber": "string",
"originatorName": "string",
"reference": "string",
"payerName": "string",
"counterpartAccount": {
"identification": {
"iban": "string",
"other": {
"identification": "string",
"schemeName": {
"code": "BBAN",
"proprietary": "string"
},
"issuer": "string"
}
}
},
"mandateType": "PaperMandate"
}
Code copied

Response (application/json)

  • 202 Success
  • 400 Bad Request
  • 403 Forbidden
  • 404 Not Found
  • 500 Server Error
  • 503 Server Error

Success

{
"halLinks": [
{
"name": "string",
"href": "string",
"templated": true
}
]
}
Code copied

Bad Request

{
"errors": {
"property1": [
"string"
],
"property2": [
"string"
]
},
"type": "string",
"title": "string",
"status": 0,
"detail": "string",
"instance": "string"
}
Code copied

Get all DDIs (virtual account)

get/v2/Accounts/{accountId}/Virtual/{virtualAccountId}/Mandates

Gets all of the Direct Debit Instructions associated with the virtual account

Parameters

  • accountId string, path, Required

    The unique identifier for the account. This can be retrieved from GET /V2/Accounts

  • virtualAccountId string, path, Required

    The unique identifier for the virtual account. This can be retrieved from GET /V2/Accounts/{accountId}/Virtual

  • pageNumber integer, query

    The page number to control returned results into manageable sets. Default if not supplied: 1

  • pageSize integer, query

    The page size to control returned results into manageable sets. Default if not supplied: 50

  • Authorization string, header, Required

    Your API Token, retrieved from the web portal

Response (application/json)

  • 200 Success
  • 400 Bad Request
  • 403 Forbidden
  • 409 Conflict
  • 500 Server Error
  • 503 Server Error

Success

{
"directDebitMandates": [
{
"mandateId": "d4dbf0da-b5aa-43ae-b9db-c2aff331d3ad",
"payerName": "string",
"payerBban": "string",
"payerAccountNumber": "string",
"payerSortCode": "string",
"reference": "string",
"serviceUserNumber": "string",
"originatorName": "string",
"mandateType": "PaperMandate",
"state": "Active"
}
],
"halLinks": [
{
"name": "string",
"href": "string",
"templated": true
}
]
}
Code copied

Bad Request

{
"errors": {
"property1": [
"string"
],
"property2": [
"string"
]
},
"type": "string",
"title": "string",
"status": 0,
"detail": "string",
"instance": "string"
}
Code copied

Amend a DDI (virtual account)

patch/v1/Accounts/{accountId}/Virtual/{virtualAccountId}/Mandates/{mandateId}

Requests amendments to Direct Debit mandate for virtual account

Supported reason codes are: C - Account transfered to a different branch of bank/building society E - Instruction amended

Parameters

  • accountId string, path, Required

    The unique identifier for the account. This can be retrieved from GET /v1/Accounts

  • virtualAccountId string, path, Required

    The unique identifier for the virtual account

  • mandateId string, path, Required

    The unique Direct Debit Instruction identifier

  • Authorization string, header, Required

    Your API Token, retrieved from the web portal

  • DigitalSignature string, header, Required

    Signed hash of the body of the request. The hash is signed by your private key

  • X-Request-Id string, header, Required

    A unique identifier for the request

Request Payload (application/json)

  • reasonCode string, Required

    Reason code for requesting the amendment

    Pattern
    ^[EC]{1}$
  • newDebtorAccount object, Required

    Information about the counterpart in a given transaction

request

{
"reasonCode": "string",
"newDebtorAccount": {
"identification": {
"iban": "string",
"other": {
"identification": "string",
"schemeName": {
"code": "BBAN",
"proprietary": "string"
},
"issuer": "string"
}
}
}
}
Code copied

Response (application/json)

  • 202 Success
  • 400 Bad Request
  • 403 Forbidden
  • 404 Not Found
  • 500 Server Error
  • 503 Server Error

Success

{
"halLinks": [
{
"name": "string",
"href": "string",
"templated": true
}
]
}
Code copied

Bad Request

{
"errors": {
"property1": [
"string"
],
"property2": [
"string"
]
},
"type": "string",
"title": "string",
"status": 0,
"detail": "string",
"instance": "string"
}
Code copied

Return a DDI (virtual account)

post/v1/Accounts/{accountId}/Virtual/{virtualAccountId}/Mandates/{mandateId}/Returns

Requests rejection for the supplied Instruction identifier

Parameters

  • accountId string, path, Required

    The unique identifier for the account. This can be retrieved from GET /v1/Accounts

  • virtualAccountId string, path, Required

    The unique identifier for the virtual account

  • mandateId string, path, Required

    The unique Direct Debit Instruction identifier

  • Authorization string, header, Required

    Your API Token, retrieved from the web portal

  • DigitalSignature string, header, Required

    Signed hash of the body of the request. The hash is signed by your private key

  • X-Request-Id string, header, Required

    A unique identifier for the request

Request Payload (application/json)

  • rejectionReason string, Required

    The reason why the DDI is being returned

    Pattern
    ^[BCFGHIK12356]{1}$

request

{
"rejectionReason": "string"
}
Code copied

Response (application/json)

  • 202 Success
  • 400 Bad Request
  • 403 Forbidden
  • 409 Conflict
  • 500 Server Error
  • 503 Server Error

Success

{
"halLinks": [
{
"name": "string",
"href": "string",
"templated": true
}
]
}
Code copied

Bad Request

{
"errors": {
"property1": [
"string"
],
"property2": [
"string"
]
},
"type": "string",
"title": "string",
"status": 0,
"detail": "string",
"instance": "string"
}
Code copied

Cancel a DDI (virtual account)

delete/v1/Accounts/{accountId}/Virtual/{virtualAccountId}/Mandates/{mandateId}

Requests cancellation for a Direct Debit mandate for virtual account

Supported reason codes are: 0 - Institution cancelled - refer to payer. Paying bank has cancelled instruction. 1 - Instruction cancelled by payer. Payer has instructed the paying bank to cancel the DirectDebit Instruction (Mandate). 2 - Payer deceased B - Account closed. Payer has closed their account for an unknown reason.

Parameters

  • accountId string, path, Required

    The unique identifier for the account. This can be retrieved from GET /v1/Accounts

  • virtualAccountId string, path, Required

    The unique identifier for the virtual account. This can be retrieved from GET /v1/Accounts/{accountId}/Virtual

  • mandateId string, path, Required

    The unique Direct Debit Instruction identifier

  • Authorization string, header, Required

    Your API Token, retrieved from the web portal

  • DigitalSignature string, header, Required

    Signed hash of the body of the request. The hash is signed by your private key

  • X-Request-Id string, header, Required

    A unique identifier for the request

Request Payload (application/json)

  • reasonCode string, Required

    The reason code

    Pattern
    ^[0-2B]{1}$

request

{
"reasonCode": "string"
}
Code copied

Response (application/json)

  • 202 Success
  • 400 Bad Request
  • 403 Forbidden
  • 404 Not Found
  • 500 Server Error
  • 503 Server Error

Success

{
"halLinks": [
{
"name": "string",
"href": "string",
"templated": true
}
]
}
Code copied

Bad Request

{
"errors": {
"property1": [
"string"
],
"property2": [
"string"
]
},
"type": "string",
"title": "string",
"status": 0,
"detail": "string",
"instance": "string"
}
Code copied

Bacs DDI webhooks

The following webhooks relate to managing Direct Debit Instructions. The webhooks can occur in response to an endpoint (as detailed below) but also if we receive a DDI from the Bacs payment service. The webhooks returned are the same regardless of whether a real or virtual account endpoint is used. Note that the webhook names include the term "mandate". This reflects the code, but should be understood to mean "Direct Debit Instruction".

You may also receive a Bacs Mandate Migrated webhook which is prompted by information received from Bacs.

Bacs DDI codes reference

The following tables give additional detail on the meanings of the various codes used in managing Bacs DDIs.

AUDDIS codes

CodeDescription
0NNew Instruction
0CCancel Instruction
0SSubstitute Instruction (Migrate the Instruction from paper to AUDDIS)

ADDACS Direct Debit Instruction amendment reason codes

CodeReasonExamples
CInstruction transferred to another account at a different branch of the paying bankThe payer has moved to a new house and wishes to transfer their account to a local branch.
The paying bank has closed a branch and set up a new customer account at another sort code.
EInstruction transferred to another account at the same branch of the paying bankThe payer has got married and wants to transfer a DDI from their own account to a joint account.
The paying bank has allocated a new account to the customer.

ADDACS Direct Debit Instruction cancellation reason codes

CodeReasonDescription
0Institution cancelled - refer to payerPaying bank has cancelled the Direct Debit Instruction. Service user cannot collect via Direct Debit on this account. If Direct Debit is to continue the service user must obtain a new DDI for a new account.
1Instruction cancelled by payerPayer has instructed the paying bank to cancel the Direct Debit Instruction.
2Payer deceased 
BAccount closedPayer has closed their account for an unknown reason.

Bank returned AUDDIS (rejection) codes

CodeReasonDescription
1Instruction cancelled by payerPayer has instructed paying bank to cancel DDI.
2Payer deceased. 
3Account transferredAccount transferred to another bank or building society.
5No accountAccount number is not recognised at the paying bank.
6No InstructionInstruction does not exist on paying bank’s database (only applies to receipt of a 0C).
BAccount closedPayer has closed their account for an unknown reason.
CAccount transferred to a different branch of the bank/building societyNew account details supplied to the service user by paying bank.
FInvalid account typePaying bank does not allow Direct Debits on this type of account.
GBank will not accept Direct Debits on accountPaying bank does not allow Direct Debits on this account.
HInstruction has expiredOccurs when a service user attempts to convert a DDI which is shown as expired on the paying bank’s database.
IPayer Reference is not uniquePaying bank has matched the DDI to an existing DDI with a similar reference that has more or fewer characters.
KInstruction cancelled by paying bankPaying bank has cancelled the DDI. Service user cannot collect via Direct Debit on this account. If Direct Debit is to continue the service user must obtain a new DDI for a new account.